Take the 2-minute tour ×

Say we have this bit of code to draw a regular polygon (compute it's vertex coordinates)

for i=1 to n
 angle += 360/n
 x = cos(angle) * radius
 y = sin(angle) * radius

Here, the basic idea is to increment the angle and compute the "cursor's" coordinate. For a big N the cursor would describe a circle.

Is there anything like this but for cubes and tetrahedrons or other regular polyhedrons? Imagine a cube inside a tennis ball with it's vertices on the tennis ball's line (every tennis ball has a squiggly line on it). This line can be the trajectory of the cursor that visits the cube's vertices

I'm thinking of an algorithm along the lines of:

for i=1 to ...
 yaw += ...
 pitch += ...
 x = radius * sin(pitch) * cos(yaw)
 y = radius * sin(pitch) * sin(yaw)
 z = radius * cos(pitch)
share|improve this question
This page might help - vb-helper.com/tutorial_platonic_solids.html - I don't think there's a general formula for the platonic solids. –  ChrisF Feb 13 '12 at 9:42
add comment

1 Answer

As given by ChrisF, there isn't and there needn't be a formula for the regular platonic solids. Just use the given Cartesian coordinates. Geometry on a sphere is much more constrained than on a circle.

The approach that you suggest is based on the spherical coordinates with fixed radius, hence all the generated points will lie on a sphere.

Anyway, when using a single loop, what you'll get is a curve (a polyline approximation to the curve). When increasing the yaw and pitch simultaneously, you'll obtain a kind of a spheric spiral, depending on the ratio of the steps and the ranges.

We are much more familiar with the use of a double loop on yaw (0 to 180°) and pitch (0 to 360°) independently, allowing you to mesh the sphere with meridians and parallels.

share|improve this answer
add comment

Your Answer


