Object Hierarchy | Related C++ Class: CMatrix3
A double precision floating point 3 by 3 matrix.
| m0 m1 m2 |
| m3 m4 m5 |
| m6 m7 m8 |
Get | Get2 | GetQuaternion | Invert |
InvertInPlace | Mul | MulInPlace | Set |
SetFromQuaternion | SetIdentity | Transpose | TransposeInPlace |
TransposeInverse | TransposeInverseInPlace | ||
var oRoot = Application.ActiveProject.ActiveScene.Root // Create two cubes, first is the original and second is rotated var oCube = oRoot.AddGeometry("Cube","MeshSurface", "Cube") var oCube2 = oRoot.AddGeometry("Cube","MeshSurface", "Cube2") var oTrans2 = oCube2.Kinematics.Local.Transform var oMat3 = XSIMath.CreateMatrix3() oTrans2.GetRotationMatrix3 ( oMat3 ); // Modify the matrix to rotate around z oMat3.value(0,0) = Math.cos (45); oMat3.value(0,1) = -Math.sin (45); oMat3.value(1,1) = Math.cos (45); oMat3.value(1,0) = Math.sin (45); oTrans2.SetRotationFromMatrix3 ( oMat3 ); oCube2.Kinematics.Local.Transform = oTrans2; var vbArr = new VBArray( oMat3.Get2() ); var array = vbArr.toArray(); Application.LogMessage( "SIMatrix3 after the rotation" + " m00:" + array[0] + " m01:" + array[1] + " m02:" + array[2] + " m10:" + array[3] + " m11:" + array[4] + " m12:" + array[5] + " m20:" + array[6] + " m21:" + array[7] + " m22:" + array[8] ); // Expected results: //INFO : SIMatrix3 after the rotation // m00:0.5253219888177297 m01:-0.8509035245341184 m02:0 // m10:0.8509035245341184 m11:0.5253219888177297 m12:0 // m20:0 m21:0 m22:1 |