# Thread: noob question: want to use splines to draw a gear

1. ## noob question: want to use splines to draw a gear

Hi,

Noob question: I have a function that makes approx. 2400 (X,Y)-coordinates for a single tooth on a gear. In order for me to draw the whole gear, I rotate these 2400 points by 14 teeth = more than 30.000 points!

I connect them like this:
Code :
``` int skipPoints = 50;
for (int i=0; i<numRotations; i++)
{
glBegin(GL_LINE_STRIP);
for (int j=0; j< N_kontur; j=j+skipPoints)
glVertex2f( -allX[i][j], allY[i][j] ); // negative X-values
glEnd();

glBegin(GL_LINE_STRIP);
for (int j=0; j< N_kontur; j=j+skipPoints)
glVertex2f( allX[i][j], allY[i][j] ); // positive X-values
glEnd();
}```

Finally, I tried to make the gear rotate using gluttimerfunc - BAD idea... The animation is "flashing", due to the high number of points. I then introduced "skipPoints" in the code above, and this kind of solves the flashing problem. My new problem is lack of detail:

Question: How do I interpolate my gear profile, maybe using splines/bezier curves/manipulators (?? whatever they're called) to draw the whole gear using only a fragment of the current (large) number of points?

I read a bit about it - I think I need to figure out the control points - or is there a better option?

2. ## Re: noob question: want to use splines to draw a gear

Not clear enough. Can you please post an image of what you achieve by above?

If I get you correctly, interpolation will affect your rotation and movement of gear. To reposition your tooth to create another instance you need to change coordinates of vertices by using blending function of the evaluator ie. X' = X + f(X)...

By "lack of detail" do you point to surface shading of gear teeth ?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•