Returns the 16 components of this matrix in an array. The values
in the array are ordered the same as the SIMatrix4.Get output parameters. This is
the layout of the matrix:
| m0 m1 m2 m3 |
| m4 m5 m6 m7 |
| m8 m9 m10 m11 |
| m12 m13 m14 m15 |
Note: This method must be used with scripting languages that don't
support arguments passed by reference such as JScript. For more
information on getting output arguments, see About Output Argument
Arrays.
Object SIMatrix4.Get2(); |
oArray = SIMatrix4.Get2(); |
Array ordered as m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15.
NewScene,false CreatePrim "Cube", "MeshSurface" Translate , 10, 20, 30, siAbsolute, siParent, siObj, siXYZ set om = XSIMath.CreateMatrix4 selection(0).Kinematics.Global.Transform.GetMatrix4 om Application.LogMessage "SIMatrix4.Value(i,j)" Application.LogMessage om(0,0) & " " & om(0,1) & " " & om(0,2) & " " & om(0,3) Application.LogMessage om(1,0) & " " & om(1,1) & " " & om(1,2) & " " & om(1,3) Application.LogMessage om(2,0) & " " & om(2,1) & " " & om(2,2) & " " & om(2,3) Application.LogMessage om(3,0) & " " & om(3,1) & " " & om(3,2) & " " & om(3,3) Application.LogMessage "" Application.LogMessage "array = SIMatrix4.Get2" m = om.Get2 Application.LogMessage m(0) & " " & m(1) & " " & m(2) & " " & m(3) Application.LogMessage m(4) & " " & m(5) & " " & m(6) & " " & m(7) Application.LogMessage m(8) & " " & m(9) & " " & m(10) & " " & m(11) Application.LogMessage m(12) & " " & m(13) & " " & m(14) & " " & m(15) Application.LogMessage "" Application.LogMessage "SIMatrix4.Get m0, m1, m2..." om.Get m(0),m(1),m(2),m(3),m(4),m(5),m(6),m(7),m(8),m(9),m(10),m(11),m(12),m(13),m(14),m(15) Application.LogMessage m(0) & " " & m(1) & " " & m(2) & " " & m(3) Application.LogMessage m(4) & " " & m(5) & " " & m(6) & " " & m(7) Application.LogMessage m(8) & " " & m(9) & " " & m(10) & " " & m(11) Application.LogMessage m(12) & " " & m(13) & " " & m(14) & " " & m(15) 'INFO : "SIMatrix4.Value(j,i)" 'INFO : "1 0 0 0" 'INFO : "0 1 0 0" 'INFO : "0 0 1 0" 'INFO : "10 20 30 1" 'INFO : "" 'INFO : "array = SIMatrix4.Get2" 'INFO : "1 0 0 0" 'INFO : "0 1 0 0" 'INFO : "0 0 1 0" 'INFO : "10 20 30 1" 'INFO : "" 'INFO : "SIMatrix4.Get m0, m1, m2..." 'INFO : "1 0 0 0" 'INFO : "0 1 0 0" 'INFO : "0 0 1 0" 'INFO : "10 20 30 1" |
// create a null and translate, rotate and scale it GetPrim("Null", null, null); Translate(null, 1.73296599336766, 3.21359046016228, -0.321359046016228, siRelative, siView, siObj, siXYZ, null, null, null, null, null); Rotate(null, -102.375, 0, 0, siRelative, siLocal, siObj, siXYZ, null, null, null); Rotate(null, 0, -22.5, 0, siRelative, siLocal, siObj, siXYZ, null, null, null); Scale(null, 1.55705996131528, 1.55705996131528, 1.55705996131528, siRelative, siLocal, siObj, siXYZ, null, null, null); // get object from selection var o = selection(0); // get global transform from object var t = o.kinematics.global.transform; var m = XSIMath.CreateMatrix4(); t.getmatrix4( m ); var vbArr = new VBArray( m.Get2() ); var jsArr = vbArr.toArray(); var cCrLf = String.fromCharCode(13,10); Application.LogMessage( cCrLf + "|" + round(jsArr[0],3) + " " + round(jsArr[1],3) + " " + round(jsArr[2],3) + " " + round(jsArr[3],3) + "|" + cCrLf + "|" + round(jsArr[4],3) + " " + round(jsArr[5],3) + " " + round(jsArr[6],3) + " " + round(jsArr[7],3) + "|" + cCrLf + "|" + round(jsArr[8],3) + " " + round(jsArr[9],3) + " " + round(jsArr[10],3) + " " + round(jsArr[11],3) + "|" + cCrLf + "|" + round(jsArr[12],3) + " " + round(jsArr[13],3) + " " + round(jsArr[14],3) + " " + round(jsArr[15],3) + "|" + cCrLf ); function round( n, numdecplaces ) { var f = Math.pow(10, numdecplaces ); return Math.round(n * f)/f; } //INFO : " //|1.439 0.582 -0.128 0| //|0 -0.334 -1.521 0| //|-0.596 1.405 -0.308 0| //|1.733 3.214 -0.321 1| //" |