#### Archived

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

# Equations

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

## 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 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 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 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 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 on other sites
Sorry for my brutal honesty, but the best way to find a list of equations all in one place is by going to www.google.com and searching for "conic equations" or "polygon equations" or something.

Free Speech, Free Sklyarov
Fight the unconstitutional DMCA.

Commander M

1. 1
2. 2
Rutin
19
3. 3
JoeJ
16
4. 4
5. 5

• 35
• 23
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631702
• Total Posts
3001812
×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!