I have been trying to draw a small stellated dodecahedron (would post an image if I had enough rep) using OpenGL, and would like to generate the vertices programmatically. I'm looking for a way to map each of the "peak" vertices of this polyhedron to the "valley" vertices of the regular dodecahedron.
After reading everything I could find on Google (where most is about origami), I realize that in geometry (unlike when using only triangles) you just need 5 vertices to produce a pentagram, thus the definition of this polyhedron uses only 12 vertices, the pentagram "peaks", and doesn't include the 20 vertices of the original, regular dodecahedron inside. If I want my mesh to be empty in the center it seems like I need to combine the vertices of the SSD and the regular dodecahedron.
I found a useful site that lists the vertex coordinates. I have plotted some from both tables and found that they match (dodecahedron fits inside SSD), and begun to look into how to map them automatically.
Using trial and error I found that
peak vertex C ($0$, $-\phi^2$, $-\phi$) has valley vertices
- F ($1/\phi$, $-\phi$, $0$)
- G ($-1/\phi$, $-\phi$, $0$)
- K ($0$, $-1/\phi$, $-\phi$)
- S ($1$, $-1$, $-1$)
- T ($-1$, $-1$, $-1$).
I'm not sure if there's any useful pattern that I should know about, or if I should just create my own tables "by hand", such as peaks[0].valleys = {5, 6, 10, 18, 19 } from the above, and so on.
Triangle vertices will need to be in the right order (counter clockwise), and I will need to calculate the triangle faces' normals as well. Is there any obvious symmetry, or something else to understand, that would make this simpler and/or more elegant, or should I just do it the hard way like I have so far?
Turns out there are indeed enough patterns to generate the 12+20 vertices pretty concisely.
I identified the 5 valley vertices for each of the 12 peak vertices and wrote them down in tables, and found the following:
All vertices in the triangle based small stellated dodecahedron, use 3 out of 5 values: 0, and 4 successive $\phi$-based values in a Fibonacci-like series. For example, $0$, $1/\phi$ ($p_0$), $1$ ($p_1$), $\phi$ ($p_2$), and $\phi^2$ ($p_3$). (See Golden ratio.)
The 12 peak vertices can be generated by rotating the sequence [0, $p_3$, $p_2$]. E.g. if the $Y$ coordinate is 0, $Z$ will be $p_3$ and $X$ will be $p_2$. For each of the 3 possibly configurations, find the 4 permutations of positive and negative for $p_2$ and $p_3$.
The valleys' coordinates are generated per dimension. Depending on which value in [$0$, $p_3$, $p_2$] the peak has in a dimension, its valleys' 5 coordinates in that dimension will follow 1 out of 3 different sequences. The signs also follow patterns depending on the peak's value, and sign if not 0, in that dimension.
Out of the 20 valleys, 8 are on the form ($\pm p_1$, $\pm p_1$, $\pm p_1$) and form a cube. Each peak has exactly 2 valleys that belong to this cube.
To generate the valleys in the right order (counter clockwise) for correct OpenGL face orientation, observe if the peak has an odd or even number of negative coordinates.
The normals follow similar rules and be deduced column-wise if we look at the valley coordinates for each (correctly oriented) face.