Topic

Polyhedra

The five Platonic solids and their relatives have coordinates in Q, Q(√2) or Q(√5), so their volumes, angles and symmetries can be found exactly.

const D = solids.dodecahedron();     // (±1, ±1, ±1) and cyclic shifts of (0, ±1/φ, ±φ)
D.euler;                             // 20 − 30 + 12 = 2
D.volume;                            // 10 + 2√5
D.dihedralCosines;                   // [−√5/5]
D.dual().faceCounts;                 // { 3: 20 }: the icosahedron
D.symmetry();                        // { order: 120, rotations: 60, group: PermGroup, … }
polyhedron([[0,0,0], [3,0,0], [0,2,0], [0,0,5], [2,2,2]]);   // the convex hull of any exact points

Faces, found and proved

polyhedron(points) builds the convex hull. The faces are found in floating point, by testing which planes through three points have every other point on one side. Then each face is proved exactly: all its vertices lie on its plane, every other vertex is strictly on the inner side, and every point given is a corner. A point inside the hull is refused rather than silently dropped. With faces known, edges and vertex configurations (the faces around a vertex, such as 3.4.3.4 for the cuboctahedron) follow by counting.

Exact measurements

The volume is a sum of tetrahedra from the centre, 16det⁡(a−c,b−c,d−c)\tfrac16\det(a - c, b - c, d - c), exact in the field of the coordinates. The dodecahedron with these coordinates has edge 5−1\sqrt5 - 1 and volume 10+2510 + 2\sqrt5, which agrees with 15+754a3\tfrac{15 + 7\sqrt5}{4}a^3. Areas need one more square root, which algebraic numbers handle: the icosahedron's surface is 20320\sqrt3. The angle between two faces along an edge has cosine −n1⋅n2∣n1∣∣n2∣-\tfrac{n_1 \cdot n_2}{|n_1||n_2|} for outward normals, and these are exact too: 13\tfrac13 for the tetrahedron, 0 for the cube, −55-\tfrac{\sqrt5}{5} for the dodecahedron.

Euler's formula and duals

For every convex polyhedron V−E+F=2V - E + F = 2. The dual swaps vertices and faces: reflecting each face's plane in a sphere about the centre gives a vertex, and each old vertex gives a face. The cube and octahedron are duals, as are the dodecahedron and icosahedron; the tetrahedron is its own dual; the cuboctahedron's dual is the rhombic dodecahedron, with twelve rhombic faces and two kinds of vertex.

Symmetry groups

A symmetry about the centre is a linear map, and it is fixed by where it sends one vertex and two of its neighbours. symmetry() tries every such image in floating point, with a wide margin, keeps the ones that send the vertices onto themselves, and checks each generator of the group exactly: MTM=IM^{\mathsf T}M = I and every vertex goes to a vertex. The group comes back as a PermGroup on the vertices, with the rotations as a subgroup: order 24 (12 rotations) for the tetrahedron, 48 (24) for the cube and octahedron, 120 (60) for the dodecahedron and icosahedron. The rotation groups are A₄, S₄ and A₅.

callreturns
polyhedron(points, { name }), new Polyhedron(vertices, faces)Polyhedron: vertices, faces, edges, V, E, F, euler, center
faceCounts, vertexConfigurations, edgeLengths2Combinatorics and the edge lengths that occur
volume, surfaceArea, faceArea(k), dihedralCosinesExact numbers
dual(), symmetry()A Polyhedron; { order, rotations, group, rotationGroup, name }
solids, prism(n, { height })tetrahedron, cube, octahedron, dodecahedron, icosahedron, cuboctahedron, truncatedTetrahedron, truncatedOctahedron, truncatedCube
Try itEdit the code and run it with @ratmath/geo and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.
Ctrl/⌘ + Enter runs