DEV Community

Zaid554
Zaid554

Posted on

Platonic solids, and more...

You can drag the solid with the mouse or screen touch. Set the speed to 0 if you really want to control its position.

Open holes in the faces to see the hidden side. Close the holes to see actual solids (and improve performance).

Becomes slow (down to 3 fps) on my computer when the number of faces is at its maximum, with holes.

No library, as usual.



A few days ago, I read that the vertices of an icosahedron were on the surface of a cube. This gave me an idea of an easy way to calculate the coordinates of its vertices.

I tried it, and used my perspective projection formulas for a nicer result.

Once this icosahedron was draw, I had the idea to divide its faces into triangles, projecting the intermediate points on the surface of a unity sphere, and iterate this process to get more and more faces.

Then I had the idea this could be done with all Platonic solids. The result is not always as fine as I whished,

Then I added a few features for fun.

Top comments (0)