SIMatrix3.TransposeInPlace

SIMatrix3.TransposeInPlace

説明

この行列を転置して置き換えます(this = Transpose(this))。

C#構文

SIMatrix3.TransposeInPlace();

スクリプト構文

SIMatrix3.TransposeInPlace();

1. VBScript の例

dim m1

' Create 3x3 matrix.

set m1 = XSIMath.CreateMatrix3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0)

m1.TransposeInPlace

2. JScript の例

NewScene (null, false);

var oRoot = Application.ActiveProject.ActiveScene.Root

// Create two cubes, the first one is rotated and second 

// is the transpose in place of the first one

var oCube = oRoot.AddGeometry("Cube","MeshSurface", "Cube")	

var oCube2 = oRoot.AddGeometry("Cube","MeshSurface", "Cube2")	

var oTrans = oCube.Kinematics.Local.Transform

var oTrans2 = oCube2.Kinematics.Local.Transform

var oMat3 = XSIMath.CreateMatrix3()

oTrans2.GetRotationMatrix3 ( oMat3 );

// Modify the matrix to scale and rotate around z

oMat3.value(0,0) = 2 * Math.cos (45);

oMat3.value(0,1) = -2 * Math.sin (45);

oMat3.value(1,1) = 2 * Math.cos (45);

oMat3.value(1,0) = 2 * Math.sin (45);

oTrans.SetRotationFromMatrix3 ( oMat3 );	

oCube.Kinematics.Local.Transform = oTrans;

var vbArr = new VBArray( oMat3.Get2() );

var array = vbArr.toArray();

Application.LogMessage( "SIMatrix3 before transpose" +

"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] );

oMat3.TransposeInPlace()

oTrans2.SetRotationFromMatrix3 ( oMat3 );

var vbArr = new VBArray( oMat3.Get2() );

var array = vbArr.toArray();

Application.LogMessage( "SIMatrix3 after transpose" +

"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] );

oCube2.Kinematics.Local.Transform = oTrans2;

// Expected results:	

//INFO : SIMatrix3 before transpose 

//		m00:1.0506439776354594	m01:-1.7018070490682368 m02:0 

//		m10:1.7018070490682368	m11:1.0506439776354594	m12:0	

//		m20:0			m21:0			m22:1

//INFO : SIMatrix3 after transpose 

//		m00:1.0506439776354594	m01:1.7018070490682368	m02:0

//		m10:-1.7018070490682368 m11:1.0506439776354594	m12:0 

//		m20:0			m21:0			m22:1

関連項目

SIMatrix3.Transpose SIVector3 SIMatrix3 SIMatrix4 SIRotation SITransformation SIQuaternion