Tesseract in 3D: 4D Rotation Lab

A chrome-and-glass hypercube floating over a Blender pedestal with a three-ring gimbal; rotate it in six 4D planes and slice it.

Presets

Playback

Polytope

Pick one of the four regular 4D polytopes with a 3D-like structure.

Rotation rates in the six planes

Each slider rotates the figure in one coordinate plane; the ones with W are purely 4D.

Projection and slice

Viewer distance changes the perspective squeeze; the slice slider picks the hyperplane w = s.

Camera

Layers

Quality

Model checks

The science

Rotations in four dimensions

In 3D a rotation turns around an axis; in 4D it turns in a plane. There are six coordinate planes (XY, XZ, XW, YZ, YW, ZW), so a 4D rotation has six independent rates. Each is a Givens rotation: in the plane (i, j) the coordinates change by x_i′ = x_i cosθ − x_j sinθ, x_j′ = x_i sinθ + x_j cosθ. The page multiplies these into one 4x4 matrix R, which stays orthogonal (R^T R = I, det R = +1) so every 4D length and angle is preserved. XY, XZ and YZ are the three familiar rotations; the three that involve w are what make a hypercube appear to turn inside out.

From 4D to your screen

The vertices are first projected from 4D to 3D with a perspective viewer on the w axis at distance d4: (x, y, z) → (x, y, z) · d4 / (d4 − w). Points with larger w are nearer to the 4D viewer and appear larger (amber); points with negative w shrink (blue). The 3D figure is then drawn by an ordinary perspective camera. This is why the “cube within a cube” of the tesseract is not a real nested cube: its edges have equal 4D length 2a, but the projected lengths differ (third graph).

Slicing

The cross-section of a 4D object with the hyperplane w = s is a 3D object. For every edge whose end points lie on opposite sides of s the page interpolates the crossing point. For an unrotated tesseract at s = 0 you get 8 points forming a cube; as the figure rotates the slice morphs through prisms, octahedra-like shapes and a single point at the tips, the way a sphere passing through a plane appears to a flatlander as a growing and shrinking disc.

Counting the parts

Vertices, edges and faces are found from the coordinates (nearest-neighbour edges, squares or triangles). The tesseract has 16 vertices, 32 edges, 24 square faces and 8 cubic cells; the 16-cell has 8, 24, 32 and 16; the 24-cell has 24, 96, 96 and 24; the 5-cell has 5, 10, 10 and 5. All obey the 4D Euler relation V − E + F − C = 0.

Honest simplifications

The polytopes are drawn as wireframes with translucent faces; cells are not shaded and there is no hidden-edge removal, because in a projection of a 4D object nothing is really hidden. The six rates are applied as sequential small rotations (240 steps per second), which is exact when the rotations commute (for example XY with ZW) and a first-order composition otherwise; the matrix is re-orthonormalised every 400 steps. The colour scale is a depth cue, not physical. 5-cell coordinates are the standard regular-simplex coordinates, centred and scaled to the common circumradius.

What to try

  • Start with the classic double rotation: XY and ZW at the same rate give a rigid, periodic motion (isoclinic) that returns to the start after 2 pi / w seconds, as the third check shows.
  • Set only XW: the inner cube grows, passes through the outer one and the figure turns inside out; watch the w values in the first graph swap sign.
  • Drag the slice slider and read the second graph: 8 points exist only between the extreme w values of the figure.
  • Switch to the 24-cell and the 5-cell and compare the vertex, edge, face and cell counts with the Euler value in the readouts.
  • Reduce d4 to 2.4 to exaggerate the 4D perspective; the longest projected edge in the third graph soars while the true edge never changes.
Loading model...
Loading Blender model...
Fourth coordinate w of three vertices against time
Points in the 3D cross-section against the slice position
Projected edge lengths against the constant true 4D length
Rotation rate in each of the six planes
Made with 🟠 Blender · Three.js