PDA

View Full Version : Positionning an object on a spline



Millo
12-30-2000, 01:48 AM
Hi!
I would like to write a small traffic engine for my building model viewer. As a track for the cars I need an invisible spline. I seems to me that generating the spline values with an evaluator, as the Red Book suggests, is simple, but of no use, because I can't access to the generated vertex values (next and previous x,y and z point values to interpolate the position and direction of the car).
glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 6, &ctrlpoints1[0][0]);
glEnable(GL_MAP1_VERTEX_3);
...
glEvalCoord1f((GLfloat) i/30.0);

Is it true? If it is, can someone suggest me how to generate a spline (possibly a terrific cubic one)? http://www.opengl.org/discussion_boards/ubb/smile.gif

DFrey
12-30-2000, 05:40 AM
You definately should not use OpenGL as a math library if you are concerned about performance at all. As far as finding a nice cubic spline, just try asking Google (http://www.google.com) about cubic splines. You'll get hundreds of good hits.