4x4行列の(i,j)番目の値(Double)を設定したり、戻したりします。ここで、iは行を示し、jは列を示します。
| m[0,0] m[0,1] m[0,2] m[0,3] |
| m[1,0] m[1,1] m[1,2] m[1,3] |
| m[2,0] m[2,1] m[2,2] m[2,3] |
| m[3,0] m[3,1] m[3,2] m[3,3] |
ヒント: Value は SIMatrix4
オブジェクトのデフォルトのプロパティなので、括弧を使用するだけで、m(j,i)などのようにプロパティ名を省いてもメソッドを呼び出せます。
' Create a cube and rotate NewScene , false CreatePrim "Cube", "MeshSurface" CreatePrim "Cube", "MeshSurface" Rotate , -84.375, 0, 0, siRelative, 70, siObj, siXYZ Rotate , 0, -51.75, 0, siRelative, 70, siObj, siXYZ Rotate , 0, 0, -42.75, siRelative, 70, siObj, siXYZ Translate , 1.07335099741008, 0.996258472356974, -0.539267618951516, siRelative, siView, siObj, siXYZ Scale , 1.67311411992263, 1, 1, siRelative, siLocal, siObj, siXYZ Scale , 1, 1, 1.52224371373308, siRelative, siLocal, siObj, siXYZ ' Get the cube from the selection and access its global ' kinematic state property to get at its global transform set o = selection(0) set gks = o.kinematics.global set t = gks.transform set m = xsimath.creatematrix4 t.GetMatrix4 m Application.LogMessage "matrix4.value(i,j)" & vbCrLf & _ "|"&FormatNumber(m(0,0),3)&" "&FormatNumber(m(0,1),3)&" "&FormatNumber(m(0,2),3)&" "&FormatNumber(m(0,3),3)&"|"& vbCrLf & _ "|"&FormatNumber(m(1,0),3)&" "&FormatNumber(m(1,1),3)&" "&FormatNumber(m(1,2),3)&" "&FormatNumber(m(1,3),3)&"|"& vbCrLf & _ "|"&FormatNumber(m(2,0),3)&" "&FormatNumber(m(2,1),3)&" "&FormatNumber(m(2,2),3)&" "&FormatNumber(m(2,3),3)&"|"& vbCrLf & _ "|"&FormatNumber(m(3,0),3)&" "&FormatNumber(m(3,1),3)&" "&FormatNumber(m(3,2),3)&" "&FormatNumber(m(3,3),3)&"|"& vbCrLf m.get m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15 Application.LogMessage "matrix4.get" & vbCrLf & _ "|"&FormatNumber(m0,3)&" "&FormatNumber(m1,3)&" "&FormatNumber(m2,3)&" "&FormatNumber(m3,3)&"|"& vbCrLf & _ "|"&FormatNumber(m4,3)&" "&FormatNumber(m5,3)&" "&FormatNumber(m6,3)&" "&FormatNumber(m7,3)&"|"& vbCrLf & _ "|"&FormatNumber(m8,3)&" "&FormatNumber(m9,3)&" "&FormatNumber(m10,3)&" "&FormatNumber(m11,3)&"|"& vbCrLf & _ "|"&FormatNumber(m12,3)&" "&FormatNumber(m13,3)&" "&FormatNumber(m14,3)&" "&FormatNumber(m15,3)&"|" 'INFO : "matrix4.value(i,j) '|0.761 -0.703 1.314 0.000| '|0.640 -0.459 -0.616 0.000| '|0.942 1.192 0.092 0.000| '|1.073 0.996 -0.539 1.000| '" 'INFO : "matrix4.get '|0.761 -0.703 1.314 0.000| '|0.640 -0.459 -0.616 0.000| '|0.942 1.192 0.092 0.000| '|1.073 0.996 -0.539 1.000|" |