Greating 3D-Graphics on visual basic
'Find the normal vector
With Sides (i)
' * * * * * * * *
Nx = (. Points (1). Y - Points (0). Y) * (. Points (. NumPoints). Z - Points (0). Z) - (. Points (1). Z - Points (0). Z) * (. Points (. NumPoints). Y - Points (0). Y)
Ny = (. Points (1). Z - Points (0). Z) * (. Points (. NumPoints). X - Points (0). X) - (. Points (1). X - Points (0). X) * (. Points (. NumPoints). Z - Points (0). Z)
Nz = (. Points (1). X - Points (0). X) * (. Points (. NumPoints). Y - Points (0). Y) - (. Points (1). Y - Points (0). Y) * (. Points (. NumPoints). X - Points (0). X)
'Normalize the normal vector (make length of 1)
Length = Sqr (Nx ^ 2 + Ny ^ 2 + Nz ^ 2)
. Normal. X = Nx / Length
. Normal. Y = Ny / Length
. Normal. Z = Nz / Length
End With
Next i
End Function
Private Function CreateTables ()
'Create cosine and sine lookup table
For i = 0 To 359
CosAng (i) = Cos (i * (3.14159265358979/180)) 'convert degrees to radians
SinAng (i) = Sin (i * (3.14159265358979/180)) 'convert degrees to radians
Next i
End Function
Main Interface