2

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
 plot(x,y)
end

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)
 plot(x,y,z)
end
adrianton3
  • 2,258
  • 3
  • 20
  • 33
  • This page might help - http://www.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 09:42

2 Answers2

0

Sounds like Fibonacci spheres or an attract/repulse approach is what you're looking for. This has been discussed in this topic: Evenly distributing n points on a sphere

beyond
  • 451
  • 2
  • 15
0

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.