Title: Platonic Solids Part 2: The tetrahedron
A tetrahedron has four faces that are equilateral triangles. In an equilateral triangle, the sides have the same lengths and they meet at 60 degree angles. Figure 1 shows a tetrahedron.
Finding the Tetrahedron's Vertices
It is a trigonometric fact that in a triangle with angles of 30, 60, and 90 degrees, the sides have relative lengths of 1, 2, and as shown in Figure 2. These lengths are not absolutethey are relative to each other. For example, if the short side has length 4, the other sides have lengths 4×2 and 4×.
Now imagine you're looking at the tetrahedron from the top as shown in Figure 3. By symmetry, the projections of the sides of the tetrahedron bisect the angles in the solid's base. Those angles are each 60 degrees, so the bisected angles are 30 degrees. Since one of the other angles in this smaller triangle (one of them is shaded blue) is 90 degrees, the remaining angle must be 180  90  30 = 60 degrees. That means the blue triangle shown in Figure 3 is a 306090 triangle.
If the sides of the tetrahedron have length 1, then the blue triangle's bottom side has length 1/2. Then because this is a 306090 triangle, the other sides must have lengths and as shown in Figure 4.
Now suppose you want the tetrahedron's top vertex to lie in the vertical Y axis and the bottom face to lie in the XZ plane. (Typically in 3D WPF the Y axis is the vertical one.) Then the values shown in Figure 4 give the coordinates of all four vertices with the exception of the Y coordinate of the top vertex as shown in Figure 5.
Now imagine looking at the tetrahedron from the side, looking parallel to the Z axis. Figure 6 shows the tetrahedron from almost this angle. The view is turned just a little so you can still see all four sides.
The tetrahedron's edges have length 1 so the green triangle in Figure 6 has side lengths 1, , and y. Because this is a right triangle, you can calculate y like this:
This means the coordinates of the tetrahedron's four vertices are:
If you want to center the tetrahedron at the origin, so each vertex lies the same distance from the origin, subtract from each vertex's Y coordinate.
The Example Program
The example program available for download uses those points to draw a tetrahedron. The program also calculates the distances between the points to verify that they are all 2 units apart.
The program uses the following code to generate the tetrahedron's vertices.
// Return the vertices for a tetrahedron.
private Point3D[] MakeVertices()
{
List points = new List();
points.Add(new Point3D(0, Math.Sqrt(2.0 / 3.0), 0));
points.Add(new Point3D(1 / Math.Sqrt(3.0), 0, 0));
points.Add(new Point3D(1.0 / (2.0 * Math.Sqrt(3)), 0, 0.5));
points.Add(new Point3D(1.0 / (2.0 * Math.Sqrt(3)), 0, 0.5));
// Move down by 1 / (2 * Sqrt(3)) to center.
Vector3D offset =
new Vector3D(0, 1.0 / 2.0 / Math.Sqrt(3.0), 0);
for (int i = 0; i < points.Count; i++)
points[i] = points[i] + offset;
// Verify that the points are all 1 unit apart.
for (int i = 0; i < points.Count  1; i++)
{
for (int j = i + 1; j < points.Count; j++)
{
Vector3D vector = points[i]  points[j];
Debug.Assert(Math.Abs(1  vector.Length) < 0.00001,
"Points " + i + " and " + j +
" are not 1 unit apart");
}
}
return points.ToArray();
}
This code creates the four vertices defined by the earlier equations and adds them to a list. It then subtracts from each vertex's Y coordinate to center the tetrahedron at the origin.
The code then finds the vector between each pair of points and asserts that the vector has length 1. This shows that each pair of vertices is 1 unit away from the others so this really is a regular tetrahedron.
The rest of the program's code deals with using WPF to display the tetrahedron's faces, its edges, and the axes.
Download the example to experiment with it and to see additional details.
