Cheap 3D to 2D Projection Matrix
PaperPen3D
Or the Gerhold Projection
I show you how to multiply
three coordinates with three 2d bases to move
left and right with cosine and up and down with sine
to the right spot, like on a piece of paper.
A 2D ijkPicture of a 3D graph can be found
in the calc3book.pdf from mecmath.net.
That had let me think how to do that on the screen.
The following algorithm covers most of
the steps i figured out already to do the standard
transforms before projecting with this nice formula.
All three angles start at 0
α := xAxis Angle
β := yAxis Angle
γ := zAxis Angle
u
_{{x,y,z}} := Unit of the vectors
of the projection base.
should all have same size, .
else the thing stretch to a side
when rotating
The projection is a 2x3 matrix.
I had the idea to use three two dimensional vectors.
The idea came from orthogonal bases and
the memory of the ijkNotation Picture
showing the three base vectors on the axes.
Each column holds a base vector for x,y or z.
[len*cos({x,y,z}angle), len*sin({x,y,z}angle)]
Instead of taking numbers i took the unit circle
and angles.
P =
u_{x}*Math.cos(α)
 u_{y}*Math.cos(β)
 u_{z}*Math.cos(γ)

u_{x}*Math.sin(α)
 u_{y}*Math.sin(β)
 u_{z}*Math.sin(γ)

x = points[i]
y = points[i+1]
z = points[i+2]
Apply a local 3x3 base
x = x*XBx+y*XBy+z*XBz
y = x*YBx+y*YBy+z*YBz
z = x*ZBx+y*ZBy+z*ZBz
Rotate the object
Do local translation to origin
x = Ox + Tx + x
y = Oy + Ty + y
z = Oz + Tz + z
U = Origin, T = Translation
Rotate the object around the world.
Maybe i have rendered the perspective
here already.
If i multiply the 3D coordinates now
with P, i get the correct x' and y' for
the 2D screen.
P*[x;y;z] = [x';y']
Ok, i have figured out transforms above, to
prove the work.
This here is the projection onto the screen:
x' = x*u_{x}*Math.cos(α)
+ y*u_{y}*Math.cos(β)
+ z*u_{z}*Math.cos(γ)

y' = x*u_{x}*Math.sin(α)
+ y*u_{y}*Math.sin(β)
+ z*u_{z}*Math.sin(γ)

Now i can shift the picture on the 2D screen
by adding x' = origin2x + x' and
y' = origin2y + y'
Could apply the 2D stuff on the image now.
The text of this document is not very good,
but i hope you get the point until here.
Will rewrite it technically.