Results 1 to 2 of 2

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

  1. #1
    Member Contributor
    Join Date
    Aug 2011
    Posts
    75

    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. #2
    Senior Member Regular Contributor
    Join Date
    Jun 2009
    Location
    FL , USA
    Posts
    192

    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 ?

Similar Threads

  1. noob question
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 07-13-2005, 06:13 AM
  2. Another noob question
    By stolas in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-26-2004, 05:35 PM
  3. Draw GEAR(HELP!!!!!!!!!!!!!!!! )
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-09-2002, 06:29 AM
  4. little question from a nOOb
    By M3mPHiS in forum OpenGL: User Software
    Replies: 2
    Last Post: 01-06-2002, 03:22 AM
  5. Evaluators and Splines Question....
    By JMaynard in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-12-2000, 12:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean