💠 Tesseract — 4D Hypercube

A tesseract is the 4-dimensional analogue of a cube. Just as a cube has 8 vertices/12 edges/6 faces, a tesseract has 16 vertices, 32 edges, 24 square faces and 8 cubic cells. To visualise it in 2D we apply two successive projections: a 4D→3D perspective projection (viewing from W=5) followed by a 3D→2D perspective projection. Drag the canvas to rotate in the XY plane. Use the sliders to independently control all 6 rotation planes of 4D space. Vertices are coloured by their W coordinate (the "depth" in the 4th dimension). 🇺🇦 Українська

3D Rotations (drag canvas)

4D Rotations (W-plane)

Animation

Projection

Vertices16
Edges32
Faces24
Cells (cubes)8

How 4D Rotation Works

In 4D space, rotation occurs in a plane (not around an axis). There are C(4,2)=6 independent rotation planes: XY, XZ, XW, YZ, YW, ZW. Each is parameterised by a single angle θ. The 4D rotation matrix for e.g. the XW plane is the identity except for the 2×2 block [cosθ, −sinθ; sinθ, cosθ] in rows/columns 0 and 3 (treating XYZW as indices 0-3). Composing all six rotations gives the current orientation in 4D. A perspective projection from 4D with the viewer at W=d collapses (x,y,z,w)→(x·d/(d−w), y·d/(d−w), z·d/(d−w)), and then a second 3D perspective projects to screen. By slowly varying the XW angle you watch the inner cube "grow" through the outer cube — just as a 2D shadow of a rotating cube sees an inner square swell through the outer square.