, Visual C#


         


myEye.orig_coord(0) _
+ myEye.orig_coord(1) * myEye.orig_coord(1) + _
myEye.orig_coord(2) * myEye.orig_coord(2))
Dim phi As Double = Atan2(myEye.orig_coord(2), r1)
' phi theta:
Select Case keyData
Case Keys.Left
theta = theta - delta_theta
Case Keys.Up
phi = phi - delta_phi
If phi < -PI / 2 Then phi = -PI / 2
Case Keys.Right
theta = theta + delta_theta
Case Keys.Down
phi = phi + delta_phi
If phi > PI / 2 Then phi = PI / 2
Case Else
Exit Function
End Select
' :
myEye.orig_coord(0) = r1 * Cos(theta)
myEye.orig_coord(1) = r1 * Sin(theta)
myEye.orig_coord(2) = r2 * Sin(phi)
' PictureBox1:
PictureBox1.Invalidate()
End Function
.
38.4. CalculateTransformation.
'
' :
Private Function CalculateTransformation() As myClassMatrix3D
' z,
' y-z:
Dim transformation1 As myClassMatrix3D = _
myClassMatrix3D.GetZRotPointToYZ(myEye)
' x,
' z:
Dim transformation2 As myClassMatrix3D = _
myClassMatrix3D.GetXRotPointToZ(myEye)
' z, z.
' :
Return transformation1.TimesMatrix(transformation2)
End Function
Form1:
Public Class Form1
Inherits System.Windows.Forms.Form

End Class
.