Hi Adrian,
It was a good suggestion to go back to look at this method. I found a
way to do it that could use simple rotations. The dihedral angles are
given in such a way that implies vertex and edge numbers so the order is
unimportant and can remain as is. After the face angles (more on this
below) and edge lengths are calculated, construction can begin.
The first edge is length 1 and goes from 0,0,0 to 0,1,0. The third
vertex is plotted on the x,y plane at len,0,0 and the rotated on x,y by
face angle. The fourth vertex is also plotted on the x,y plane at
len,0,0, rotated on x,y by face angle, and additionally rotated on y by
dihedral angle. The faces are then added and the tetrahedron is complete.
I pushed the beta program, but it can only construct about half of the
tetrahedra. The coloring options aren't implemented, and the faces are
currently color coded. To construct the model that was given on the
example page
tetra59 12 -v | antiview -v 0.02
The tetrahedra it produces are interesting in that they can be bricked
into an eventual dipyramid of sorts (if its chiral pair were also used).
In the final program it might be better to construct it starting the
first edge from 0,0,0 to 0,0,1 so it could be mirrored N fold as an option.
The two formulaic forms work at all angles in their ranges, and I found
that their new case (2) seems to work from 60 to 90 degrees even though
they say it stops at 60. I've yet to see why this is so, so I added -w
to by pass the angle constraint so I might see why (perhaps they are
repeats)
The not so good new is, the formula for finding a face cosine from the
dihedral cosines isn't stable and will about half the time find a cosine
greater than 1. I have to program set to error out if that happens or it
will plot all the points on the Y axis.
An example will be
tetra59 57 -v | antiview -v 0.02
...
face_angle_a = (cos(a) + cos(b) * cos(c)) / (sin(b) * sin(c));
ERROR: face_cos_a: greater than 1: 1.29179606750063103
info: input (radians): a = 1.0472 b = 0.942478 c = 0.942478
info: input (degrees): a = 60 b = 54 c = 54
info: cos(a) = 0.5 cos(b) = 0.587785 cos(c) = 0.587785
info: numerator: cos(a) + cos(b)*cos(c) = 0.845492
info: sin(b) = 0.809017 sin(c) = 0.809017
info: denominator: sin(b)*sin(c) = 0.654508
The source given for the dihedral formula is here and the mathematician
inverted the formula, but there must be something about doing that which
can't be reversed perfectly. The numerator can be a larger value than
the denominator. Unless there is a way to fix it, or find another way to
determine the face angle, I will have to withdraw the program or keep it
in beta state. However, if it can be fixed, the program may work nicely.
https://web.archive.org/web/20151125044900/http://www.had2know.com/academics/dihedral-angle-calculator-polyhedron.html
Roger