, Visual C#


         

ByVal m00 As Double, ByVal


Public Sub New( _
ByVal m00 As Double, ByVal m01 As Double, _
ByVal m02 As Double, ByVal m03 As Double, _
ByVal m10 As Double, ByVal m11 As Double, _
ByVal m12 As Double, ByVal m13 As Double, _
ByVal m20 As Double, ByVal m21 As Double, _
ByVal m22 As Double, ByVal m23 As Double, _
ByVal m30 As Double, ByVal m31 As Double, _
ByVal m32 As Double, ByVal m33 As Double)
M(0, 0) = m00 : M(0, 1) = m01 : M(0, 2) = m02
M(0, 3) = m03
M(1, 0) = m10 : M(1, 1) = m11 : M(1, 2) = m12
M(1, 3) = m13
M(2, 0) = m20 : M(2, 1) = m21 : M(2, 2) = m22
M(2, 3) = m23
M(3, 0) = m30 : M(3, 1) = m31 : M(3, 2) = m32
M(3, 3) = m33
End Sub
' :
Public Function TimesMatrix( _
ByVal right_matrix As myClassMatrix3D) As myClassMatrix3D
Dim result As New myClassMatrix3D
Dim value As Double
For i As Integer = 0 To 3
For j As Integer = 0 To 3
value = 0
For k As Integer = 0 To 3
value = value + M(i, k) * _
right_matrix.M(k, j)
Next
result.M(i, j) = value
Next
Next
Return result
End Function
' z y-z :
Public Shared Function GetZRotPointToYZ( _
ByVal pt As myClassPoint3D) As myClassMatrix3D
Dim R As Double = Sqrt(pt.orig_coord(0) * _
pt.orig_coord(0) + _
pt.orig_coord(1) * pt.orig_coord(1))
Dim stheta As Double = pt.orig_coord(0) / R
Dim ctheta As Double = pt.orig_coord(1) / R
Return New myClassMatrix3D( _
ctheta, stheta, 0, 0, _
-stheta, ctheta, 0, 0, _
0, 0, 1, 0, _
0, 0, 0, 1)
End Function
' x z:
Public Shared Function GetXRotPointToZ( _