#### Archived

This topic is now archived and is closed to further replies.

# Equation of a sphere

This topic is 5553 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

My idea is to plot the points of a sphere about the origin given it''s radius. I started with the equation for a circle: x^2 + y^2 = radius^2. I then extended it to x^2 + y^2 + z^2 = radius^2 (for three dimensions. My questions is, how can I precalculate all the x,y,z triplets given a radius and an increment? I''m stuck. Gur

##### Share on other sites
it doenst really work that way im affraid... if you want to plot a sphere, the best thing to do would be to raytrace it i suppose, but that could be quite a lot of work.. wont a filled circle fit your needs?

##### Share on other sites
Well, you could use a voxel system and iterate over x,y, and z, then check if each pixel is within a certain radius of the origin. If it is, you plot a voxel at that location. Perhaps if you explained more of what you are trying to do...

##### Share on other sites

I''ve tested some code written using these equations and it''s pretty good i reckon, just have to plug it into OpenGL and see what happens.

##### Share on other sites
If you want to sample the surface of a sphere semi-randomly without seeing iso-lines, then you should check Halton sampling on a sphere:

http://www.acm.org/jgt/papers/WongLukHeng97

-cb

1. 1
2. 2
Rutin
23
3. 3
JoeJ
20
4. 4
5. 5
gaxio
13

• 24
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631734
• Total Posts
3001933
×