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