Feb 23, 2015 at 11:55am UTC
i am trying to get two rotation matrices to multiply. this is the code that i have so far written. (the x,y and z are for a different part of the question.
void MultiplyMatrix ()
{
double x, y, z, theta, beta, gamma;
cout << "input x value" << endl;
cin >> x;
cout << "input y value" << endl;
cin >> y;
cout << "input z value" << endl;
cin >> z;
cout << "input theta value" << endl;
cin >> theta;
cout << "input beta value" << endl;
cin >> beta;
cout << "input gamma value" << endl;
cin >> gamma;
double thetamatrix[3][3] = {{cos(theta),-sin(theta),0}, {sin(theta),cos(theta),0}, {0,0,1}};
double betamatrix[3][3] = {{cos(beta),0,-sin(beta)}, {0,1,0},{sin(beta),0,cos(beta)}};
double product[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
for (int row = 0; row < 3; row++)
{
for (int col = 0; col < 3; col++)
{
for (int inner = 0; inner < 2; inner++)
{
product[row][col] += thetamatrix[row][inner] * betamatrix[inner][col];
}
std::cout << product[row][col] << " ";
}
std::cout << "\n";
}
}
void main() {
MultiplyMatrix();
getchar();
}