高级会员
注册日期: 06-11
帖子: 1527
精华: 15
现金: 6353 标准币
资产: 6353 标准币
|
PCDIMS坐标变换——从pcdims矩阵变换到opengl显示矩阵
void CCadTransform::GetGLMatrix (double matrix[16]) const
{
/* OpenGL matrix is a 4x4 matrix in column-major order. Translate component is
in last column. m_rotate is a 3x3 matrix in column-major order. */
// rotation matrix (3x3)
matrix[0] = m_rotate[E_MAJOR_AXIS][X_AXIS] * m_scale[X_AXIS];
matrix[1] = m_rotate[E_MAJOR_AXIS][Y_AXIS] * m_scale[X_AXIS];
matrix[2] = m_rotate[E_MAJOR_AXIS][Z_AXIS] * m_scale[X_AXIS];
matrix[3] = 0.0;
matrix[4] = m_rotate[E_MINOR_AXIS][X_AXIS] * m_scale[Y_AXIS];
matrix[5] = m_rotate[E_MINOR_AXIS][Y_AXIS] * m_scale[Y_AXIS];
matrix[6] = m_rotate[E_MINOR_AXIS][Z_AXIS] * m_scale[Y_AXIS];
matrix[7] = 0.0;
matrix[8] = m_rotate[E_ALIGN_AXIS][X_AXIS] * m_scale[Z_AXIS];
matrix[9] = m_rotate[E_ALIGN_AXIS][Y_AXIS] * m_scale[Z_AXIS];
matrix[10] = m_rotate[E_ALIGN_AXIS][Z_AXIS] * m_scale[Z_AXIS];
matrix[11] = 0.0;
// translate component
matrix[12] = m_translate[X_AXIS];
matrix[13] = m_translate[Y_AXIS];
matrix[14] = m_translate[Z_AXIS];
matrix[15] = 1.0;
} // CCadTransform::GetGLMatrix()
|