, Visual C#


         


38.1. Form1_Load.
' z = f(x, y):
Public Function f(ByVal x As Double, ByVal y As Double) _
As Double
' z = f(x, y) :
Dim a As Double = 1.03
Dim b As Double = 1.02
Dim c As Double = 1.01
' z = f(x, y) :
f = Sqrt(c * c * (200 - x * x / (a * a) - _
y * y / (b * b)))
End Function
' :
Private myEye As myClassPoint3D
' :
Private Const x_max As Integer = 20
Private Const y_max As Integer = 20
Private Const x_min As Integer = -10
Private Const y_min As Integer = -10
' :
Private Points(x_max, y_max) As myClassPoint3D
' :
Private Axes(3) As myClassPoint3D
' :
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As EventArgs) Handles MyBase.Load
' :
myEye = New myClassPoint3D(40, 20, 20)
' :
Dim x, y, z As Double : Dim i, j As Integer
' (i,j)- x,y
' z z = f(x, y):
For i = 0 To x_max
x = i + x_min
For j = 0 To y_max
y = j + y_min
' z z = f(x, y):
z = f(x, y)
Points(i, j) = New myClassPoint3D(x, y, z)
Next
Next
' (axes) :
Axes(0) = New myClassPoint3D(0, 0, 0) ' -.
Axes(1) = New myClassPoint3D(30, 0, 0) ' (axis) x.
Axes(2) = New myClassPoint3D(0, 30, 0) ' y.
Axes(3) = New myClassPoint3D(0, 0, 30) ' z.