I wanted to know if there is an algorithm I could use to show a 3D line on a 2D screen. The line is made up of 2 points with X, Y, Z coordinates.
My end goal is to have a bunch of lines that may make up something like cubes, then to be able to move a camera around to view these cubes. The code below is what I have so far.
type Point =
{ X : int
Y : int
Z : int }
type Line =
{ A : Point
B : Point }
let line =
{ A = { X = 0; Y = 0; Z = 0 }
B = { X = 50; Y = 50; Z = 50 } }
Draw an isometric box with faint lines and then connect the front left-hand lower corner to the rear right-hand upper corner with a strong line.
Additional post :
I used a land survey system and calculated 2D N,E coordinates of an isometric box as
Point A, N,E of 0 , 0
Point B, N,E of -25.00 , 43.3013
Point C, N,E of 0.00 , 86.6025
Point D, N,E of 50.00 , 86.6025
Then the 2D direction and distance of the required line set in perspective is 60 degrees azimuth at a distance of 100 between Point A and Point D. The true distance of the 3D line would be the Square Root of (50^2 + 50^2 + 50^2) or 86.60 .