Platonic Solids Part 2: The tetrahedron

[tetrahedron]



[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



[tetrahedron]
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 [tetrahedron] as shown in Figure 2. These lengths are not absolute–they are relative to each other. For example, if the short side has length 4, the other sides have lengths 4×2 and 4×[tetrahedron].



[tetrahedron]
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 30-60-90 triangle.



[tetrahedron]
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 30-60-90 triangle, the other sides must have lengths [tetrahedron] and [tetrahedron] as shown in Figure 4.

[tetrahedron]
Now suppose you want the tetrahedron’s top vertex to lie in the vertical Y axis and the bottom face to lie in the X-Z 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.



[tetrahedron]
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, [tetrahedron], and y. Because this is a right triangle, you can calculate y like this:


[tetrahedron]

This means the coordinates of the tetrahedron’s four vertices are:


[tetrahedron]

If you want to center the tetrahedron at the origin, so each vertex lies the same distance from the origin, subtract [tetrahedron] 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 [tetrahedron] 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 and look at the code for details. Also see the example Draw interlocked tetrahedrons in a cage of “line segments” using WPF and C#.


Download Example   Follow me on Twitter   RSS feed   Donate




This entry was posted in algorithms, graphics, mathematics, wpf and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

5 Responses to Platonic Solids Part 2: The tetrahedron

  1. Draw two interlocked tetrahedrons defined by a cube using WPF and XAML

    My post Platonic Solids Part 2: The tetrahedron shows how to calculate the locations of a tetrahedron’s vertices. The example Draw two interlocked tetrahedrons using WPF, XAML, and C# uses those vertices to draw two interlocked tetrahedrons. The vertex calculations are interesting (if you like geometry), but there’s an easier way to find the vertices of two interlocked tetrahedrons. You can use the corners of a cube to define the vertices of two interlocked tetrahedrons as shown in the picture on the right. Much of this example is similar to Draw two interlocked tetrahedrons …

  2. phan sang says:

    Hi Rod, Could you tell me where was the origin of the coordinate at the first time because I don’t understand this part, Thank you a lot :
    Subtracts 1/(2*sqrt(3)) from each vertex’s Y coordinate to center the tetrahedron at the origin.

    • phan sang says:

      And one more question. According to the algorithm, four points which were created will always be 1 unit apart from each others and the will be no redundancy edges(4 points, 3 edges for each one) so I think it’s okay to skip the checking part and connect them right away 😀 .

      • RodStephens says:

        Well naturally if the calculations are correct you don’t need to check them. But the math is complicated enough that there could have been a mistake. It’s even more an issue with the even more complex solids such as the icosahedron.

        Having verified that the calculations are correct, you can remove the test if you like.

    • RodStephens says:

      In the first calculations the tetrahedron is sitting on the X-Z plane with its top vertex on the Y axis. Figure 6 shows it best.

Leave a Reply

Your email address will not be published. Required fields are marked *