Ok, I'm confusecd about the mathematics required for 3D rotations. I have:
void xrot(D3DMATRIX &mat, double rot)
{
mat._11 = 1; mat._12 = 0; mat._13 = 0; mat._14 = 0;
mat._21 = 0; mat._22 = cos(rot); mat._23 = sin(rot); mat._24 = 0;
mat._31 = 0; mat._32 = -sin(rot); mat._33 = cos(rot); mat._34 = 0;
mat._41 = 0; mat._42 = 0; mat._43 = 0; mat._44 = 1;
}
void yrot(D3DMATRIX &mat, double rot)
{
mat._11 = cos(rot); mat._12 = 0; mat._13 = -sin(rot); mat._14 = 0;
mat._21 = 0; mat._22 = 1; mat._23 = 0; mat._24 = 0;
mat._31 = sin(rot); mat._32 = 0; mat._33 = cos(rot); mat._34 = 0;
mat._41 = 0; mat._42 = 0; mat._43 = 0; mat._44 = 1;
}
void zrot(D3DMATRIX &mat, double rot)
{
mat._11 = cos(rot); mat._12 = sin(rot); mat._13 = 0; mat._14 = 0;
mat._21 = -sin(rot); mat._22 = cos(rot); mat._23 = 0; mat._24 = 0;
mat._31 = 0; mat._32 = 0; mat._33 = 1; mat._34 = 0;
mat._41 = 0; mat._42 = 0; mat._43 = 0; mat._44 = 1;
}
which cause a rotation around their respective axies. Do I assume they are in the form:
11 12 13 14
21 22 23 24
31 32 33 34
41 42 43 44
??? or am I orientated wrong? The thing is, when I rotate, I'm not seeing what I expect. One problem is if I have a 2D plane along the Z axis at 0, and I multiply the 'rotation around the x axis' by it, I get, well, 0 multiplied by anything is 0. I loose the depth. I want to rotate a plane (like a floor) around the X-axis. Is there any good online help? Or can you help?
Thanks
Taylor
void xrot(D3DMATRIX &mat, double rot)
{
mat._11 = 1; mat._12 = 0; mat._13 = 0; mat._14 = 0;
mat._21 = 0; mat._22 = cos(rot); mat._23 = sin(rot); mat._24 = 0;
mat._31 = 0; mat._32 = -sin(rot); mat._33 = cos(rot); mat._34 = 0;
mat._41 = 0; mat._42 = 0; mat._43 = 0; mat._44 = 1;
}
void yrot(D3DMATRIX &mat, double rot)
{
mat._11 = cos(rot); mat._12 = 0; mat._13 = -sin(rot); mat._14 = 0;
mat._21 = 0; mat._22 = 1; mat._23 = 0; mat._24 = 0;
mat._31 = sin(rot); mat._32 = 0; mat._33 = cos(rot); mat._34 = 0;
mat._41 = 0; mat._42 = 0; mat._43 = 0; mat._44 = 1;
}
void zrot(D3DMATRIX &mat, double rot)
{
mat._11 = cos(rot); mat._12 = sin(rot); mat._13 = 0; mat._14 = 0;
mat._21 = -sin(rot); mat._22 = cos(rot); mat._23 = 0; mat._24 = 0;
mat._31 = 0; mat._32 = 0; mat._33 = 1; mat._34 = 0;
mat._41 = 0; mat._42 = 0; mat._43 = 0; mat._44 = 1;
}
which cause a rotation around their respective axies. Do I assume they are in the form:
11 12 13 14
21 22 23 24
31 32 33 34
41 42 43 44
??? or am I orientated wrong? The thing is, when I rotate, I'm not seeing what I expect. One problem is if I have a 2D plane along the Z axis at 0, and I multiply the 'rotation around the x axis' by it, I get, well, 0 multiplied by anything is 0. I loose the depth. I want to rotate a plane (like a floor) around the X-axis. Is there any good online help? Or can you help?
Thanks
Taylor