Example
Project an eight-vertex cube with one perspective divide.
highlighted = computed this step
Step 1 — Cube vertices
Set up the exact input values.
cube vertices{’A’: (Fraction(1, 1), Fraction(1, 1), Fraction(1, 1)), ’B’: (Fraction(3, 1), Fraction(1, 1), Fraction(1, 1)), ’C’: (Fraction(3, 1), Fraction(3, 1), Fraction(1, 1)), ’D’: (Fraction(1, 1), Fraction(3, 1), Fraction(1, 1)), ’E’: (Fraction(1, 1), Fraction(1, 1), Fraction(2, 1)), ’F’: (Fraction(3, 1), Fraction(1, 1), Fraction(2, 1)), ’G’: (Fraction(3, 1), Fraction(3, 1), Fraction(2, 1)), ’H’: (Fraction(1, 1), Fraction(3, 1), Fraction(2, 1))}
Step 2 — Front face
Compute the highlighted value.
front projection((1, 1), (3, 1), (3, 3), (1, 3))
Step 3 — Back face
Compute the highlighted value.
back projection((1/2, 1/2), (3/2, 1/2), (3/2, 3/2), (1/2, 3/2))
Step 4 — Edges
Compute the highlighted value.
projected edges((A, B), (B, C), (C, D), (D, A), (E, F), (F, G), (G, H), (H, E), (A, E), (B, F), (C, G), (D, H))
project-a-cube
A cube projection repeats the same perspective divide for each vertex, then draws the edges between the projected points.