Option Explicit
Const ScreenWidth As Long = 640 'the width of the world we're looking at
Const ScreenHeight As Long = 480 'the height of the "world" we're looking at.
Const Depth As Long = 2 'the depth (front to back) of the world we're looking at
Dim Sy As Double 'height of our window into the world
Dim Sx As Double 'width of our window into the world
Dim Sz As Double 'a depth variable that determines which objects are visible in front of other, hidden objects
Const D As Double = 0.75 'the distance between our eye and the window in this imaginary world.
Const Fov As Double = 22 'the total field of view
Const Zn As Double = 1 'the point closest to us where we can no longer see into the imaginary world
Const Zf As Double = 30 'the point farthest from us where we can no longer see into the imaginary world
Dim s As Double 'stuff
Dim c As Double 'stuff
Dim Q As Double 'stuff
Dim X As Double 'point coords
Dim Y As Double 'point coords
Dim Z As Double 'point coords
Dim W As Double 'point coords
Dim X2 As Double 'point coords
Dim Y2 As Double 'point coords
Dim Z2 As Double 'point coords
Dim W2 As Double 'point coords
Const PiDiv180 As Double = 1.74532925199433E-02 'Pi / 180
Private Sub Draw()
X2 = X * c + ScreenWidth / 2
Y2 = Y * c + ScreenHeight / 2
Z2 = s * Zf * ((Z - Zn) / (Zf - Zn))
W2 = W * s * c
PicDisp.PSet (X2, Y2)
PicDisp.Refresh
End Sub
Private Sub Form_Load()
PicDisp.Width = ScreenWidth * Screen.TwipsPerPixelX
PicDisp.Height = ScreenHeight * Screen.TwipsPerPixelY
Sx = ScreenWidth * D / Depth
Sy = ScreenHeight * D / Depth
s = Sin(Fov / 2 * PiDiv180)
c = Cos(Fov / 2 * PiDiv180)
Q = s / (1 - Zn / Zf)
X = -5
Y = 0
Z = 0
Draw
End Sub