几何尺寸与公差论坛

 找回密码
 注册
查看: 3612|回复: 0

Matrix 矩阵变换

[复制链接]
发表于 2008-7-24 01:02:49 | 显示全部楼层 |阅读模式
1OpenGL matrix
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()
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-22 13:10 , Processed in 0.035079 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表