Presets
Playback
Solid
Camera lens
Rotation
Camera
Layers
Quality
Model check
The science
Meshes and Euler's formula
A polyhedron is stored as a list of vertices and faces; the edges are the unique vertex pairs of the faces. For any closed surface of genus g, V - E + F = 2 - 2g: 2 for every convex solid (and any deformation of a sphere), 0 for the torus. The football (truncated icosahedron) has 60 - 90 + 32 = 2.
Descartes' theorem says the angular defects add up the same way: with defect d(v) = 2*pi - sum(face angles at v), sum d(v) = 2*pi*chi (4*pi for a convex solid). It is an independent check of the topology, because it only uses geometry. The vertex figure (for example 5.6.6 for the football) is read off by walking once around a vertex.
The Archimedean solids here are built by truncating or rectifying a Platonic solid and taking the convex hull; truncation depth t = 1/(2 + 2 sin(theta/2)) (theta = face angle) makes all edges equal, which you can verify in the "longest / shortest edge" readout (1.0000).
The studio
The three rings are the Euler angles made physical: the outer ring turns about Y (yaw), the middle ring about X (pitch), the inner ring about Z (roll), and the solid hangs on the inner ring. When the middle ring reaches 90 degrees the outer and inner rings lie in the same plane: gimbal lock. The eye camera sits on the bench at distance d; the glass plane between it and the solid is the picture plane, and the rays from every vertex to the eye cross it exactly where the 2D image draws the vertex (Duerer's window). The image on the plane is rendered by the same matrix pipeline as the 2D page.
The projection pipeline
Every vertex goes through clip = P * V * M * (x, y, z, 1), then the perspective divide ndc = clip.xyz / clip.w, then the viewport map. M is the rotation from the quaternion, V moves the camera back by the distance d, and the perspective matrix has f = 1/tan(fov/2) in its first two diagonal entries and -1 in the w row, so x_ndc = f * x / (-z): similar triangles. The orthographic matrix has no division, so parallel lines stay parallel; here its size is matched to the perspective view at the origin plane (h = d * tan(fov/2)).
Dolly zoom: keeping d * tan(fov/2) constant keeps the object's size while the background perspective changes - the "vertigo" effect. Tick "Extend edges" to watch the vanishing points slide.
Back faces, hidden edges
A face is front-facing when its normal points towards the eye: n . (eye - c) > 0 (perspective) or n_z > 0 (orthographic). A GPU decides the same thing from the sign of the projected polygon area (winding order); the page computes both and checks they agree. For a convex solid an edge is visible exactly when at least one of its two faces is front-facing, so hidden-line removal is exact there (hidden edges are dashed). For the non-convex torus the page falls back to the painter's algorithm (sort faces far to near and overpaint), which is only an approximation: it can fail for cyclically overlapping faces.
Quaternions and gimbal lock
A rotation by angle a about unit axis n is q = (cos(a/2), sin(a/2) n), applied as v' = q v q* or with the matrix built from q (verified against Rodrigues' formula). Dragging composes small rotations; a drift of floating point rounding would make |q| wander, so q is renormalised. The graph shows what happens without that: a first-order update q += 0.5 dt (0, w) q grows the norm by a factor sqrt(1 + (w dt / 2)^2) per step.
Euler angles use the order yaw (Y), pitch (X), roll (Z): R = Ry * Rx * Rz. At pitch = +-90 degrees the yaw and roll axes coincide, so R depends only on yaw -/+ roll and one degree of freedom is lost (gimbal lock). A quaternion has no such singularity; the sliders are recomputed from it, and at the lock the page shows the alignment of the two axes.
Honest simplifications
The camera is an ideal pinhole (no lens distortion, no clipping of faces crossing the near plane - the camera always stays outside the solid). Shading is flat Lambert from one light. Units are the circumradius R of the solid. The edge rule for hidden lines is exact only for convex solids. Nothing here is a physical simulation: it is deterministic geometry.
Checks run in the page
1) Euler characteristic, textbook vertex/edge/face counts, closed-manifold test and angular-defect sum for all 14 meshes. 2) The 4x4 matrix pipeline against the similar-triangle formula for random cameras, and normal-based culling against winding-based culling. 3) Quaternion matrix against Rodrigues, Euler round trip, and 100 000 composed rotations keeping |q| = 1.
What to try
- Cube, "Back-face culling": count the faces that disappear as you spin; it is never more than 3 for a cube.
- Switch Perspective / Orthographic and watch the dashed back edges shift relative to the front ones.
- "Dolly zoom": the cube stays the same size while the perspective explodes.
- "Gimbal lock": move yaw and roll - the cube turns about the same axis.
- Compare V - E + F for the torus with any other solid.