shapes.module
README.md
diceKit.shapes
The polyhedra behind every die as pure data: d4 (tetrahedron), d6 (cube), d8 (octahedron), d10 and the tens die d10t (pentagonal trapezohedron), d12 (dodecahedron) and d20 (icosahedron), each with faces, outward normals, centroids, the value and label printed on each face and the direction its label points. Opposite faces add up the conventional way (7 on a d6, 9 on a d8 and a d10, 13 on a d12, 21 on a d20).
Shapes.read(kind, rotation) answers the value a die shows and how flat it lies: the face whose normal points most nearly up, or for a d4 the number at the top vertex. Shapes.score turns a d10's 0 into 10 and a tens die's digit into tens; Shapes.percentile(tens, units) makes 1 to 100 (00 and 0 is 100); Shapes.restingRotation(kind, face) gives a rotation that puts a face up. Used by the simulation, the tray and the tests; works with no tray in the world.