A tesseract (4-cube) has 16 vertices at (±1,±1,±1,±1). It is rotated in 4D using rotation matrices acting on the XW and YW planes, then projected down to 3D with a perspective divide on the 4th coordinate w — the same idea as a normal 3D→2D camera projection, one dimension up.
x' = x·cosθ − w·sinθ, w' = x·sinθ + w·cosθ (XW rotation)
scale = dist / (dist − w')
(x3, y3, z3) = (x', y, z) · scale (4D→3D projection)
- XW / YZW rotation — angular speed of rotation through the 4th dimension; this is what makes the cube-within-a-cube appear to turn inside out.
- W-slice position — a 3D hyperplane at w = const; edges of the tesseract that cross it are marked, showing the tesseract's 3D "cross-section" the way a 2D plane slicing a 3D cube gives a polygon.
- 4D perspective distance — controls how strong the w-based perspective distortion is (smaller = more dramatic size change with w).
- Show Slice — highlights only the intersection points with the current w-slice.
Real application: this exact 4D-rotation + perspective-projection technique is used in scientific visualization of 4D data (e.g. spacetime slices in relativity, or 4-parameter phase spaces) by treating one axis as a "hidden" dimension shown via projection and slicing.