PDA

View Full Version : sphere



raybones
05-18-2004, 12:41 AM
Hello everyone,

I've got a question. I want to make my own functions to drawing primitives - I want to have access to particular points. Does anybody know formula to create sphere? I searched many pages but result is none... :(

Michael Steinberg
05-18-2004, 06:59 AM
Take some aequi-surfaced polyhedron (is that the english word?) (there was this 12 sided thingy, that is well triangulizable?) and subdivide it until some expected face-size is achieved and then project the vertices to a perfect sphere. This will yield into a sphere without much distortion and without poles.

plasmonster
05-18-2004, 09:59 AM
Another approach is to specify the sphere vertices in spherical coordinates.

For any azimuth in [0,2 PI], any elevation in [-PI/2,PI/2], and a sphere radius of R

x = R * cos(azimuth) * cos(elevation)
y = R * sin(azimuth) * cos(elevation)
z = R * sin(elevation)

where the z axis goes through the poles.

You could specify an angular grid and iterate over the angles to build triangle strips, for example. Depending on the grid, this would give you so many slices and stacks in your sphere.

raybones
05-18-2004, 09:21 PM
Thanks for advices. The second method seems quite natural. I didn't 'discover' polyhedrons yet :)

Greets,
Ray