行列
- 行列
- D3DX覚書
- MatrixAffineTransformation
- MatrixDeterminant
- MatrixIdentity( Matrix& m )
- MatrixInverse
- MatrixIsIdentity
- MatrixLookAtLH
- MatrixLookAtRH
- MatrixMultiply( Matrix& out, const Matrix& in )
- MatrixMultiplyTranspose
- MatrixOrthoLH
- MatrixOrthoOffCenterLH
- MatrixOrthoOffCenterRH
- MatrixOrthoRH
- MatrixPerspectiveFovLH
- MatrixPerspectiveFovRH
- MatrixPerspectiveLH
- MatrixPerspectiveOffCenterLH
- MatrixPerspectiveOffCenterRH
- MatrixPerspectiveRH
- MatrixReflect
- MatrixRotationAxis
- MatrixRotationQuaternion
- MatrixRotationX
- MatrixRotationY
- MatrixRotationYawPitchRoll( float yaw, float pitch, float roll )
- MatrixRotationZ
- MatrixScaling
- MatrixShadow
- MatrixTransformation
- MatrixTranslation
- MatrixTranspose
- Links
D3DX覚書
D3DXMatrix系関数を自前で実装した時の覚え書きです
struct Matrix { union { float m[4][4]; struct { float m00, m01, m02, m03; float m10, m11, m12, m13; float m20, m21, m22, m23; float m30, m31, m32, m33; }; }; };
MatrixAffineTransformation
MatrixDeterminant
MatrixIdentity( Matrix& m )
m.m00 = 1.0f; m.m01 = 0.0f; m.m02 = 0.0f; m.m03 = 0.0f;
m.m10 = 0.0f; m.m11 = 1.0f; m.m12 = 0.0f; m.m13 = 0.0f;
m.m20 = 0.0f; m.m21 = 0.0f; m.m22 = 1.0f; m.m23 = 0.0f;
m.m20 = 0.0f; m.m21 = 0.0f; m.m22 = 0.0f; m.m23 = 1.0f;
MatrixInverse
MatrixIsIdentity
MatrixLookAtLH
MatrixLookAtRH
MatrixMultiply( Matrix& out, const Matrix& in )
Matrix mat = out; for ( int i=0 ; i<4 ; i++ ) { for ( int j=0 ; j<4 ; j++ ) { float sum = 0; sum += mat.m[i][0] * in.m[0][j]; sum += mat.m[i][1] * in.m[1][j]; sum += mat.m[i][2] * in.m[2][j]; sum += mat.m[i][3] * in.m[3][j]; out.m[i][j] = sum; } }
MatrixMultiplyTranspose
MatrixOrthoLH
MatrixOrthoOffCenterLH
MatrixOrthoOffCenterRH
MatrixOrthoRH
MatrixPerspectiveFovLH
MatrixPerspectiveFovRH
MatrixPerspectiveLH
MatrixPerspectiveOffCenterLH
MatrixPerspectiveOffCenterRH
MatrixPerspectiveRH
MatrixReflect
MatrixRotationAxis
MatrixRotationQuaternion
MatrixRotationX
MatrixRotationY
MatrixRotationYawPitchRoll( float yaw, float pitch, float roll )
const float sin_y = sin( yaw ); const float cos_y = cos( yaw ); const float sin_p = sin( pitch ); const float cos_p = cos( pitch ); const float sin_r = sin( roll ); const float cos_r = cos( roll );
m00 = cos_y * cos_r + sin_y * sin_p * sin_r; m01 = sin_r * cos_p; m02 = cos_r * -sin_y + sin_r * sin_p * cos_y; m03 = 0.0f;
m10 = -sin_r * cos_y + cos_r * sin_p * sin_y; m11 = cos_r * cos_p; m12 = sin_r * sin_y + cos_r * sin_p * cos_y; m13 = 0.0f;
m20 = cos_p * sin_y; m21 = -sin_p; m22 = cos_p * cos_y; m23 = 0.0f;
m30 = 0.0f; m31 = 0.0f; m32 = 0.0f; m33 = 1.0f;