HyperfolderBetween Dimensions

Technical notes

Technical Notes

How Hyperfolder computes, and the background behind it

For version 2.4.0 / Back to About & history

1. Structure

Hyperfolder is a web app that does all its computation inside the browser, without a server. It bundles the open-source three.js (r160) for 3D rendering; all geometric computation is done in its own JavaScript. The main modules are:

ModuleRole
geom.jsVector arithmetic, face normals, volume, 3D convex hull
conway.jsSeed polyhedra, Conway operations, canonicalization
library.jsNamed polyhedra (Johnson solids, stellations, geodesics, etc.)
analysis.jsClassification of congruent faces, vertex configurations, dihedral angles, coloring
unfold.jsNet generation, overlap testing, glue tabs, symmetry scoring
netview.jsLayout on paper; SVG, DXF and OBJ export
four.js / mode4d.jsDetermining the cells of 4D polytopes, projection, 4D rotation, unfolding cells, models
viewer3d.js3D view, inertial rotation, folding animation
demo.js / mobile.jsDemo mode, phone layout
i18n.jsJapanese / English switching (a phrase table for fixed text; computed text chosen when shown)

2. Representation and generation

2.1 Representation

A polyhedron is represented by a list of vertex coordinates and, for each face, the list of vertex indices around it. The vertices of each face are ordered counterclockwise as seen from outside, so that the right-hand rule gives the outward normal. Edges are derived from the faces. This orientation convention underlies the decision of which side of the net is the front and which folds are mountain or valley folds.

2.2 Convex hull

Many Johnson solids are built as the convex hull (the smallest convex polyhedron enclosing all the points) of a set of vertices made by stacking “rings” of regular polygons at different heights. The hull is computed incrementally, adding one point at a time, as a collection of triangles; coplanar triangles are then merged into a single polygon. Cupolae are built from rings of a 2n-gon and an n-gon, rotundae from half of an icosidodecahedron, and the rest from combinations of prisms, antiprisms and cupolae.

2.3 Conway operations

Conway polyhedron notation describes a shape by applying operators, from right to left, to a seed polyhedron (T, C, O, D, I, the prism Pn, the antiprism An, the pyramid Yn). For example, tI is the truncation (t) of the icosahedron (I): the soccer-ball-shaped truncated icosahedron.

The implementation builds dual d, ambo a, kis k, gyro g, chamfer c and propeller p directly as primitive operations, and defines the others as compositions:

t = dkd j = da e = aa o = daa b = dkda m = kda n = kd z = dk s = dgd

The primitive operations work by rewriting the incidences of faces, vertices and edges (flags), so the topology (how everything is connected) comes out exact. The coordinates, however, are only provisional, and the shape is tidied up by the canonicalization that follows.

2.4 Canonicalization

It is known that for every convex polyhedron there is, for each combinatorial type, exactly one shape (the canonical form) that satisfies the following three conditions at once (a theorem based on the circle-packing theory of Koebe, Thurston and others):

  1. Every edge is tangent to the unit sphere (the midsphere).
  2. The centroid of the points where the edges touch the sphere is at the origin.
  3. Every face is planar.

Following George W. Hart’s iterative algorithm (1997), the vertices are moved a little at a time towards these three conditions, repeating until the movement falls below 10−11 (at most 4000 iterations, adjusted to the number of edges). In an Archimedean solid all vertices are equivalent under symmetry, so the canonical form coincides with the uniform shape with equal edge lengths. Indeed, for all 13 the ratio of edge lengths comes out as 1.000000 (except the truncated icosidodecahedron, at 1.000005). The Catalan solids are obtained by canonicalizing the duals of the Archimedean solids in the same way.

2.5 Stellations and geodesics

3. Shape analysis

Congruent-face classes
Each face is described by its sequence of edge lengths and interior angles; congruent faces are grouped by comparing the representation that is minimal under rotation and reflection (lengths rounded to 1/2000 of the longest edge, angles to 0.05°). This is used for coloring, the legend, and identifying the kinds of parts in a geodesic dome.
Vertex configuration
The sequence of the numbers of sides of the faces around a vertex (e.g. 3.4.5.4), written in its minimal form under rotation and reflection.
Dihedral angle
Obtained from the angle θ between the normals of adjacent faces: π − θ at a convex edge and π + θ at a reflex (concave) edge. Convex edges are mountain folds and reflex edges are valley folds (when assembled with the printed side outward).
Volume and surface area
Computed as sums over the faces using the divergence theorem, and displayed scaled to the size of the template.

4. Nets

4.1 A net is a spanning tree of the faces

Consider the graph whose vertices are the faces and whose edges are the shared edges (the dual graph). Choosing a spanning tree of this graph determines a net: the tree’s edges become folds and all other edges become cuts. The root face is laid on the plane, and each child face is placed by a rigid motion so that its shared edge coincides with the same edge of its parent.

4.2 Overlap testing

Each time a new face is placed, it is checked against the faces already placed using the separating axis theorem (two convex polygons are disjoint exactly when their projections onto the normal direction of some edge of one of them are separated). Faces that merely touch at an edge or vertex are not counted as overlapping. A preliminary test with bounding rectangles saves computation.

4.3 Fitting on the paper

For print nets, each time a face is added, the rotating calipers method is applied to the convex hull of the whole piece to find its minimum bounding rectangle, and the piece is checked to fit within the printable area (the paper minus the margins and footer). If it does not fit, that face starts a new piece.

4.4 Glue tabs and numbering

Each pair of cut edges is given the same number, and a glue tab is attached to one of them. The tabs are trapezoids whose side angles are at most 50° and at most 92% of the angle of the face they are glued to. If a tab would overlap an adjacent face or another tab, 19 shapes with progressively narrower end angles and heights are tried in turn. At a vertex where the gap in the net is almost 0°, a tab physically cannot fit, so such edges are reported on screen as “edges without tabs”.

4.5 On screen: nets chosen for symmetry

The on-screen view and the 3D unfolding animation use the same symmetry-first net.

4.6 For printing: layouts chosen for paper efficiency

For print, SVG and DXF, several candidates with different roots and growth orders (compact, breadth-first, strip, random) are generated under the paper constraints, and the best is chosen by: missing tabs → number of pages → number of pieces → paper usage. Each piece is rotated to the orientation of its minimum bounding rectangle and packed onto shelves in order of height (First-Fit Decreasing).

4.7 3D unfolding animation

Each face opens into the plane of its parent when rotated about their shared edge by the angle that brings the two faces’ normals into line. These rotations are composed from parent to child in the original 3D coordinates and scaled in proportion to the unfold amount t. At t = 1 all faces lie in the plane of the root face, giving the same shape as the on-screen net.

4.8 An open problem

The question “Can every convex polyhedron be cut open along its edges alone into a single non-overlapping net?” is called Dürer’s problem, after Dürer’s nets, and has remained unsolved since G. C. Shephard formulated it in 1975. Hyperfolder’s unfolding is heuristic, but every convex polyhedron in the library unfolds into a single piece. For nonconvex polyhedra, a non-overlapping edge unfolding may not exist at all; in that case the net is split into several pieces.

5. 4D polytopes

5.1 Vertex coordinates

5.2 Finding the cells

In a convex 4D polytope, the edges are the pairs of points at the shortest distance (all the shapes treated here have equal edge lengths). For each vertex v, centrally projecting the directions to its neighbors onto a hyperplane on the opposite side from v gives a three-dimensional “vertex figure”. Each face of its convex hull corresponds to a cell containing v. The normal of the cell’s hyperplane is found as the vector orthogonal to three edge vectors (a generalized cross product), and all vertices lying on that hyperplane are collected to form the cell. The shape of the cell is obtained by taking the convex hull in 3D coordinates within the hyperplane. The result is checked with the Euler characteristic V − E + F − C = 0 (it holds for all 20).

5.3 Projection to 3D

Schlegel diagram
A perspective projection from a viewpoint on the axis through the center of the nearest cell, just outside that cell’s hyperplane. Placing the viewpoint so that it lies beyond only the nearest cell’s hyperplane and no other (rf < d < dmax) makes the nearest cell the outer shell, with the remaining cells filling its interior without gaps.
Perspective (vertex first)
A perspective projection with the viewpoint in the direction of a vertex.
Parallel projection
A projection that simply drops the fourth coordinate. The vertex-first parallel projection of the tesseract has the outline of a rhombic dodecahedron.

5.4 4D rotation

Rotations in the three planes XW, YW and ZW are combined. Because the Schlegel viewpoint is very close to the solid, rotating would carry the viewpoint inside it. The viewpoint is therefore smoothly pulled back, according to the amount of rotation, to outside the circumscribed sphere (1.8 times its radius).

5.5 Unfolding the cells into 3D

This is the same idea as a 3D net, raised by one dimension. In 4D, the face (two-dimensional) shared by a parent cell and its child is held fixed, and the child is rotated within the two-dimensional plane orthogonal to that face. This plane is spanned by the two cells’ normals; rotating by the angle between the normals opens the child cell into the same hyperplane as its parent. Overlap between cells is tested with the three-dimensional separating axis theorem (using face normals and cross products of pairs of edges as axes). Even the 120-cell and 600-cell yield non-overlapping nets in a single connected piece. During unfolding, the view switches smoothly from perspective to parallel projection, so that the cells’ true shapes are visible once fully opened.

5.6 Models

6. Display and interaction

7. Timeline of the mathematics of polyhedra

Dates follow the generally accepted accounts. “c.” indicates that the date is approximate.

YearPerson / event
c. 360 BCPlato, Timaeus. Associates the four elements and the cosmos with the five regular polyhedra (the origin of the name “Platonic solids”).
c. 300 BCEuclid, Elements, Book XIII. Constructions of the five regular polyhedra and a proof that no others exist.
3rd c. BCArchimedes describes the 13 semiregular polyhedra (the Archimedean solids). The work is lost and known through Pappus’s account in the 4th century.
1509Luca Pacioli, De divina proportione, with Leonardo da Vinci’s skeletal drawings of polyhedra.
1525Albrecht Dürer, Underweysung der Messung. Shows nets of the regular polyhedra and several Archimedean solids (among the earliest printed nets).
1568Wenzel Jamnitzer, Perspectiva corporum regularium. Depicts variations on the polyhedra in exquisite engravings.
1619Johannes Kepler, Harmonices Mundi. Systematically rediscovers the 13 Archimedean solids and describes the small and great stellated dodecahedra.
c. 1630René Descartes notes that the angular defects at the vertices of a polyhedron sum to 4π (720°), a precursor of Euler’s formula.
1750sLeonhard Euler shows V − E + F = 2 for the numbers of vertices, edges and faces of a convex polyhedron.
1809Louis Poinsot discovers the great dodecahedron and great icosahedron (with Kepler’s two, the four regular star polyhedra).
1813Augustin-Louis Cauchy proves that these four are the only regular star polyhedra.
c. 1852Ludwig Schläfli classifies the regular polytopes in four and more dimensions (six in four dimensions). Little known in his lifetime; published in 1901.
1865Eugène Catalan describes the duals of the Archimedean solids (the Catalan solids).
1880Washington Stringham independently finds the regular four-dimensional polytopes and illustrates them.
1880sVictor Schlegel devises a way of drawing four-dimensional polytopes in three dimensions (the Schlegel diagram).
1884Edwin A. Abbott, Flatland, a novel depicting higher dimensions through the eyes of a two-dimensional inhabitant.
1888Charles H. Hinton, A New Era of Thought, using the word “tesseract”.
1900Alicia Boole Stott studies three-dimensional sections of four-dimensional polytopes and popularizes the word “polytope” in English.
1938H. S. M. Coxeter et al., The Fifty-Nine Icosahedra: the 59 stellations of the icosahedron.
1948Coxeter, Regular Polytopes, the standard reference on regular polyhedra and polytopes.
1954Coxeter, Longuet-Higgins and Miller enumerate the uniform polyhedra (75).
1965John H. Conway and Michael Guy study the four-dimensional uniform polytopes and discover the “grand antiprism”.
1966Norman Johnson enumerates the 92 convex polyhedra with regular polygonal faces (the Johnson solids). In 1969 Zalgaller proves the list complete.
1971Magnus Wenninger, Polyhedron Models, the classic of making polyhedra in paper.
1975G. C. Shephard asks whether every convex polyhedron has a non-overlapping edge unfolding (Dürer’s problem; still open).
1990sGeorge W. Hart systematizes Conway polyhedron notation and publishes it on the web; in 1997 he presents a numerical algorithm for canonicalization.
2000Robert Webb releases “Stella: Polyhedron Navigator”, later developed into Great Stella / Stella4D.
2026Hyperfolder released.

8. References

Classics and foundations

  1. Euclid, Elements, Book XIII (Japanese translation: Nakamura Kōshirō, Terasaka Hidetaka, Itō Shuntarō, Ikeda Mie, trans., ユークリッド原論 [Yūkuriddo genron], Kyōritsu Shuppan, 1971).The classical proof that there are only five regular polyhedra.
  2. H. S. M. Coxeter, Regular Polytopes, 3rd ed., Dover, 1973. (Japanese translation: Hitotsumatsu Shin, supervising ed., 正多胞体 [Sei tahōtai], Maruzen Publishing, 2022.)A systematic treatment of regular polyhedra and polytopes; the basis for the 4D coordinates and the approach to projection.
  3. H. S. M. Coxeter, M. S. Longuet-Higgins, J. C. P. Miller, “Uniform Polyhedra,” Philosophical Transactions of the Royal Society A 246 (1954), 401–450.
  4. N. W. Johnson, “Convex Polyhedra with Regular Faces,” Canadian Journal of Mathematics 18 (1966), 169–200.Source of the names and numbers (J1–J92) of the Johnson solids.
  5. Hitotsumatsu Shin, 正多面体を解く [Sei tamentai o toku, “Solving the Regular Polyhedra”], Tokai University Press, 1983.

Geometry and unfolding of polyhedra

  1. Peter R. Cromwell, Polyhedra, Cambridge University Press, 1997.Covers the mathematics and history of polyhedra broadly; used to check many items in the timeline.
  2. Erik D. Demaine, Joseph O’Rourke, Geometric Folding Algorithms: Linkages, Origami, Polyhedra, Cambridge University Press, 2007.Computational geometry of nets: existence, overlap, Dürer’s problem and more.
  3. G. C. Shephard, “Convex Polytopes with Convex Nets,” Mathematical Proceedings of the Cambridge Philosophical Society 78 (1975), 389–403.
  4. John H. Conway, Heidi Burgiel, Chaim Goodman-Strauss, The Symmetries of Things, A K Peters, 2008.Describing symmetry, and notation for operations on polyhedra.

Algorithms and models

  1. George W. Hart, “Calculating Canonical Polyhedra,” Mathematica in Education and Research 6(3) (1997), 5–10.Source of the canonicalization algorithm.
  2. George W. Hart, “Conway Notation for Polyhedra,” Virtual Polyhedra. georgehart.com
  3. Magnus J. Wenninger, Polyhedron Models, Cambridge University Press, 1971; Dual Models, 1983.The classics on making paper models and their templates.
  4. Robert Webb, “Stella: Polyhedron Navigator,” Symmetry: Culture and Science, 2000.

Higher dimensions

  1. Thomas F. Banchoff, Beyond the Third Dimension, Scientific American Library, 1990.Visualizing higher dimensions through projections, slices and shadows.
  2. Edwin A. Abbott, Flatland: A Romance of Many Dimensions, 1884.Source of the homage in the app’s introductory text.

9. Related software

NameAuthor / publisherFeatures
Great Stella / Stella4DRobert Webb (Software3D)The leading software for displaying and stellating polyhedra and printing nets. Stella4D also handles 4D projections, cross-sections and 3D nets. The starting point for the idea of Hyperfolder. Paid (Windows, Mac).
polyHédronismeAnselm LevskayaOpen-source web app that generates polyhedra from Conway notation.
Polyhedra GeneratorAndrew MarshWeb app for generating polyhedra with Conway notation.
AntiprismAdrian RossiterA suite of command-line programs for generating and transforming polyhedra, including canonicalization. Open source.
Pepakura DesignerTama SoftwareTurns general 3D models into papercraft nets, adding glue tabs and edge numbers automatically.
Poly / Poly ProPedagoguery SoftwareEducational software for rotating and unfolding polyhedra.
4D ToysMarc ten BoschA physics-simulation toy that shows four-dimensional objects through their three-dimensional cross-sections.

What sets Hyperfolder apart: it is free and runs entirely in the browser; it uses separate nets for the screen (symmetry) and for printing (paper efficiency); it goes from projections of 4D polytopes all the way to 3D puzzles and strut-model parts lists; and it switches between Japanese and English.

10. Related websites

The content of linked sites is maintained by their operators and may change (checked October 2026).

11. License and credits