Archived

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

Equations

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

where can I go to get a large amount of different equations of shapes. Also if anyone knows the Equation (formula) of a Sphere, please post it. I am trying to make one in OpenGL in VB.

Share this post


Link to post
Share on other sites
I just cheat and do it with polar coordinates: set the radius to a fixed number and rotate around the x and y axis. Then I convert the whole array of polar coordinates to an array of cartesian coordinates. But then again, I''m a newbie...

Share this post


Link to post
Share on other sites
If I know what you mean:
Sphere: r*r = (x*x) + (y*y) + (z*z)
Ellipsoid: 1 = (x/rx)2 + (y/ry)2 + (z/rz)2
Torus: 1 = (r - sqrt((x/rx)2 + (y/ry)2))2 + (z/rz)2

Those are all I have on hand, I can probably dig up some more from a book I have. Say if that''s what you were looking for.

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
For the sphere you can use the cartesian equation as given by 'Null and Void':

r2 = x2 + y2 + z2

or the parametric equations

x = r*cos(theta)*sin(phi)
y = r*sin(theta)*sin(phi)
z = r*cos(phi)

where theta is the angle in the x-y plane measured from the positive x axis and phi is the declination (angle down) from the z axis to the point on the surface of the sphere.

A cone is given by:

z2 = c2(x2/a2 + y2/b2)

A Cylinder by the parametric equations

x = r*cos(theta)
y = r*sin(theta)
z = a

where theta is again the angle in the x-y plane and a is the distance of the point (on the surface of the cylinder) from the x-y plane.

A parabolic bowl can be given by

z = c2(x2/a2 + y2/b2)

Have fun!

Timkin


Edited by - Timkin on October 18, 2001 12:42:32 AM

Share this post


Link to post
Share on other sites
I have an OpenGL project in VB that makes a cube.
here is some of it.

TmpX=cos(100)
TmpY=-Sin(100)
TmpZ=Cos(100)
glVertex3d TmpX,TmpY,TmpZ

That makes a Cube.
I want the TmpX, TmpY, and TmpZ equations to make a Sphere or any other shape I want.

Share this post


Link to post
Share on other sites