Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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 $.

share|improve this answer
1  
This works, and is, indeed, simpler than a rotation. But there is a caveat: in 3D-graphics programming the orientation of a face is often crucial (the opposite sides of a face of a polyhedron may have different colors, or the other is not rendered, because it is assumed to be inside, or some such). The programmer should be aware that a reflection swaps the orientation. I don't know how OpenGL represents a polygon, but one way of reversing the orientation of a polygon is to reverse the order of the vertices. This may be a totally moot point. Just wanted to make sure that the OP is aware. –  Jyrki Lahtonen Jul 5 '11 at 6:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.