PDA

View Full Version : Draw GEAR(HELP!!!!!!!!!!!!!!!! )



08-06-2002, 11:51 PM
Can anybody tell me how to draw a gear ?? where should I start?? From which Point should I count?? How to count the radius???
Please HELP

Niftybitz
08-07-2002, 12:58 AM
Hi there!

I guess the problem you have is that you don't know how to calculate points on a circle. Well, i'll explain it to you:

Let's say we want to draw a circle with a given radius called RADIUS. Let's say that each point on the circle is a tooth from the gear. Let's also say that your gear has ten teeth. To calculate the x and y coords for each tooth, you use the following formulas:

t=given tooth
NUMBER_OF_TEETH=number of teeth on gear

x(t)=
RADIUS*sin(t*(360/NUMBER_OF_TEETH)/180/PI)

y(t)=
RADIUS*cos(t*(360/NUMBER_OF_TEETH)/180/PI)

That's it, because i think it's the math you
have a problem with.

Please mail me if you want an example and i'll see what i can do (then i'll try to create something that looks like a gear http://www.opengl.org/discussion_boards/ubb/smile.gif)

Ciao,

Niftybitz.

Gavin
08-07-2002, 02:13 AM
There is a gear example in the SDK!

Niftybitz
08-09-2002, 03:28 AM
I've just made an example of two rotating gears (they are 3D and totally composed of triangles) with the option of realtime changing the thickness of the gear teeth, the number of teeth and the height of the teeth.

Anyone interested in this example, feel free to mail me (it's written in VC++ 6.0)

Ciao,

Niftybitz.

nexusone
08-09-2002, 06:29 AM
You can e-mail it to me...
Love to see other people work...

My e-mail is listed here.



Originally posted by Niftybitz:
I've just made an example of two rotating gears (they are 3D and totally composed of triangles) with the option of realtime changing the thickness of the gear teeth, the number of teeth and the height of the teeth.

Anyone interested in this example, feel free to mail me (it's written in VC++ 6.0)

Ciao,

Niftybitz.