3x3行列の(i,j)番目の値(Double)を設定したり、戻したりします。ここで、iは行を示し、jは列を示します。
| m[0,0] m[0,1] m[0,2] |
| m[1,0] m[1,1] m[1,2] |
| m[2,0] m[2,1] m[2,2] |
ヒント: Value は SIMatrix
オブジェクトのデフォルトのプロパティなので、括弧を使用するだけで、m(j,i)などのようにプロパティ名を省いてもメソッドを呼び出せます。
' Create a cube and rotate NewScene , false CreatePrim "Cube", "MeshSurface" Rotate , -120.375, 0, 0, siRelative, siLocal, siObj, siXYZ Rotate , 0, 0, -56.25, siRelative, siLocal, siObj, siXYZ Rotate , 0, -51.75, 0, 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.creatematrix3 t.GetRotationMatrix3 m Application.LogMessage "matrix3.value(j,i)" & vbCrLf & _ "|"&FormatNumber(m(0,0),3)&" "&FormatNumber(m(0,1),3)&" "&FormatNumber(m(0,2),3)&"|"& vbCrLf & _ "|"&FormatNumber(m(1,0),3)&" "&FormatNumber(m(1,1),3)&" "&FormatNumber(m(1,2),3)&"|"& vbCrLf & _ "|"&FormatNumber(m(2,02),3)&" "&FormatNumber(m(2,1),3)&" "&FormatNumber(m(2,2),3)&"|"& vbCrLf m.get m0, m1, m2, m3, m4, m5, m6, m7, m8 Application.LogMessage "matrix3.get" & vbCrLf & _ "|"&FormatNumber(m0,3)&" "&FormatNumber(m1,3)&" "&FormatNumber(m2,3)&"|"& vbCrLf & _ "|"&FormatNumber(m3,3)&" "&FormatNumber(m4,3)&" "&FormatNumber(m5,3)&"|"& vbCrLf & _ "|"&FormatNumber(m6,3)&" "&FormatNumber(m7,3)&" "&FormatNumber(m8,3)&"|"& vbCrLf 'INFO : "matrix3.value(j,i) '|0.344 0.938 0.047| '|0.831 -0.281 -0.479| '|-0.876 0.204 -0.876| '" 'INFO : "matrix3.get '|0.344 0.938 0.047| '|0.831 -0.281 -0.479| '|-0.436 0.204 -0.876| '" |