# Platonic Solids Part 5: Cube and octahedron You may recall from the first article in this series (Platonic Solids Part 1: What are the Platonic solids?) that each platonic solid has a dual. The cube and octahedron are duals of each other.

To make a dual from a platonic solid, consider each of the solid’s vertices. Suppose faces A, B, C, … share a vertex in the original solid. Then place new vertices a, b, c, … in the middle of each of those faces and use them to define a new face in the dual.

This example program makes a cube and an octahedron with edge lengths 1 centered at the origin. If you look at the picture above, you can see that the octahedron’s vertices poke out through the middle of the cube’s faces. They don’t sit exactly on the cube’s faces because the octahedron is too big (because both shapes have edge length 1). You can make the octahedron’s vertices sit on the cube’s faces by changing the octahedron’s size so its vertices are distance 0.5 from the origin.

A commented out line in the example program makes that change. It adds a little extra to the dual octahedron’s size so its vertices stick out just a little beyond the edges of the cube. Just as a cube’s dual is an octahedron, so too an octahedron’s dual is a cube. You may recall from the post Platonic Solids Part 4: The octahedron that the vertices of the octahedron have two coordinates with value 0 and one with value . Figure 1 shows the vertex coordinates where the value y is .

The coordinates of the point in the center of an octahedron’s face is the average of the coordinates of the face’s vertices. That means the vertices for the dual cube have coordinates (±y / 3, ±y / 3, ±y / 3) where y is .

A second commented out line in the example program makes that change. It adds a little extra to the dual cube’s size so its vertices stick out just a little beyond the edges of the octahedron.

For more details about how the program works, see the earlier examples or download this example and look at the code. I encourage you to uncomment the two comments out lines (one at a time, not both at the same time) to see how the dual vertices are positioned.     ## 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.

This site uses Akismet to reduce spam. Learn how your comment data is processed.