Equation of a sphere
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
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?
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...
I think I''ve found the answer: equations 10, 11 and 12 on this page http://mathworld.wolfram.com/Sphere.html
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement