[C# Helper]
Index Books FAQ Contact About Rod
[Beginning Database Design Solutions, Second Edition]

[Beginning Software Engineering, Second Edition]

[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: Platonic Solids Part 5: Cube and octahedron

[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.

[Platonic Solids Part 5: Cube and octahedron]

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 [Platonic Solids Part 5: Cube and octahedron]. Figure 1 shows the vertex coordinates where the value y is [Platonic Solids Part 5: Cube and octahedron].

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 [Platonic Solids Part 5: Cube and octahedron].

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.

Download the example to experiment with it and to see additional details.

© 2009-2023 Rocky Mountain Computer Consulting, Inc. All rights reserved.