# Rotation of Tetrehedra for 3d Tessellation

I'm trying to render some 3d graphics with a bunch of tetrahedra. I'm trying to figure out how to rotate one tetrahedron such that it will be perfectly face-to-face with another tetrahedron. If this is confusing, multiple tetrahedra touching face to face would look like this.

I'm using OpenGL to programmatically rotate objects, so I can only rotate on one of the three axes at a time. For example, I can rotate clockwise 20 degrees on X, then counterclockwise 45 degrees in Z, etc.

Thanks for any help, let me know if you need more clarification.

-

Actually what you might want to do is flip the tetrahedron across one of its faces, without bothering with angular rotation. (I'm assuming you're talking about equilateral tetrahedra.) This way you get the full rigid motion that includes spatial translation (i.e. moving the tetrahedron over to the side a bit so it doesn't occupy the same space). If you have the coordinates of the four vertices of the figure as $a, b, c, d$ and you want to flip it across the face with edges $b, c, d$, you can simply keep the latter three vertices but define the new fourth vertex as $a' = 2(b+c+d)/3 - a$. I got this by defining the center of the face $p = (b+c+d)/3$, the normal displacement vector from $p$ to $a$, which is $n = a-p$, and then displacing $p$ in the opposite direction as $p - n$.