Make truncated tetrahedrons, octahedrons, and icosahedrons in WPF and C#


[truncated tetrahedrons, octahedrons, and icosahedrons]

The post Make a truncated cube in WPF and C# explained how to make truncated cubes. The key methods were MakeTruncatedSolidCornerMesh, which creates new faces created by removing corners, and MakeTruncatedSolidFaceMesh, which creates faces representing the original cube’s faces with the corners removed. See that example for an explanation.

Those same methods also work with other solids. (Actually just complex solids. As they’re currently written, they would incorrectly orient new faces created by cutting off concave corners.)

The only thing we need to think about for this example is how to set the parameter frac that determines how much of the edges adjacent to a corner are removed.

If frac = 0.0, the solid is unchanged. The leftmost row in the picture shows that type of solid for the tetrahedron, octahedron, and icosahedron.

If frac = 0.5, the new faces representing the removed corners touch. Because the new faces shared edges with the original faces with their corners removed, all of the solid’s edges have the same length and the result is an archimedean solid. The rightmost row in the picture shows those solids.

[truncated tetrahedrons, octahedrons, and icosahedrons]
The remaining question is, “What value of frac between 0.0 and 0.5 will also give edge lengths that are the same?” Fortunately this calculation is really easy if the solid has triangular sides.

Because the triangles are equilateral, if you cut off a corner the resulting triangle in the corner is also equilateral. That means its base and sides have the same lengths. To make the edges in the new solid all have the same length, you just need to make them 1/3rd of the original side lengths, as shown in Figure 1. That means the value frac should be 1/3.

This example does just that. It draws tetrahedrons, octahedrons, amd icosahedrons with frac equal to 0, 1/3, and 0.5.

That’s all there is to it. The fact that the original solid’s sides are equilateral triangles makes this easy.


Download Example   Follow me on Twitter   RSS feed   Donate




About RodStephens

Rod Stephens is a software consultant and author who has written more than 30 books and 250 magazine articles covering C#, Visual Basic, Visual Basic for Applications, Delphi, and Java.

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

Leave a Reply

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