static Vector3 Transform(const Vector3 &point, const D3DXMATRIX &matrix) { Vector3 result; Vector4 temp(point.X, point.Y, point.Z, 1); //need a 4-part vector in order to multiply by a 4x4 matrix Vector4 temp2; temp2.X = temp.X * matrix._11 + temp.Y * matrix._21 + temp.Z * matrix._31 + temp.W * matrix._41; temp2.Y = temp.X * matrix._12 + temp.Y * matrix._22 + temp.Z * matrix._32 + temp.W * matrix._42; temp2.Z = temp.X * matrix._13 + temp.Y * matrix._23 + temp.Z * matrix._33 + temp.W * matrix._43; temp2.W = temp.X * matrix._14 + temp.Y * matrix._24 + temp.Z * matrix._34 + temp.W * matrix._44; result.X = temp2.X/temp2.W; //view projection matrices make use of the W component result.Y = temp2.Y/temp2.W; result.Z = temp2.Z/temp2.W; return result; } static Vector3 TransformTransposed(const Vector3 &point, const D3DXMATRIX &matrix) { Vector3 result; Vector4 temp(point.X, point.Y, point.Z, 1); //need a 4-part vector in order to multiply by a 4x4 matrix Vector4 temp2; temp2.X = temp.X * matrix._11 + temp.Y * matrix._12 + temp.Z * matrix._13 + temp.W * matrix._14; temp2.Y = temp.X * matrix._21 + temp.Y * matrix._22 + temp.Z * matrix._23 + temp.W * matrix._24; temp2.Z = temp.X * matrix._31 + temp.Y * matrix._32 + temp.Z * matrix._33 + temp.W * matrix._34; temp2.W = temp.X * matrix._41 + temp.Y * matrix._42 + temp.Z * matrix._43 + temp.W * matrix._44; result.X = temp2.X/temp2.W; //view projection matrices make use of the W component result.Y = temp2.Y/temp2.W; result.Z = temp2.Z/temp2.W; return result; }