Create a function Tetrahedron that creates an equilateral tetrahedron with a given height passed as a parameter.

computer science

Description

Create a function Tetrahedron that creates an equilateral tetrahedron with a given height passed as a parameter. 

Write the code to display two of these tetrahedrons, one sitting centered on the origin, the other upside down such that the tips of the two tetrahedrons touch.  

Make the two tetrahedrons spin around the Y axis in opposite directions.  

Some useful information about tetrahedrons

Let s be the height of an equilateral tetrahedron.  The length l of a leg is:  sqrt(3./2. * s * s).  The radius (distance from the center of a face to a vertex) is sqrt(1./3. * l * l).  If you draw a line from a vertex though the center of a face to the center of the far edge, the center is 2/3 of the way to the far edge.  This should give you all you need to determine the vertices, though you may need to draw some pictures.  

Make your tetrahedron function center the object on the Y axis with the base sitting on the origin.  


Instruction Files

Related Questions in computer science category