PDA

View Full Version : query on evaluator using control points for curves



coda
01-13-2004, 01:47 AM
I wish to enquire whether the suppose i specify 3 points to draw a curve, the 1st is start point, the 2nd is end point of the curve. the last point (middle part of curve): does it actually lie on the curve or it is just a point that pulls the curve towards it?

coda
01-13-2004, 05:50 AM
I understand that evaluators uses the start, end and control points to draw a 3D surface.The control points do not lie on the surface itself so to draw a 3D 1/4 hollow cylinder. What should the middle control point be? i tried these points:

GLfloat ctrlPoints[3][3][3]={{
{-d,0.0f,1.0f},{-d,-d,1.0f},
{0.0f,-d,1.0f}}, //v=0
{{-d,0.0f,0.0f},{-d,-d,0.0f},
{0.0f,-d,0.0f}}, //v=1
{{-d,0.0f,-1.0f},{-d,-d,-1.0f},
{0.0f,-d,-1.0f}}};//v=2

assumming d is radius of cylinder. But somehow it doesn't look that accurate. In addition the following code work when i use GL_LINE but not if i change it to GL_FILL, how do i resolve this?

// the setup function
glMap2f(GL_MAP2_VERTEX_3, // Type of data generated
0.0f, // Lower u range
10.0f, // Upper u range
3, // Distance between points in the data
3, // Dimension in u direction (order)
0.0f, // Lower v range
10.0f, // Upper v range
9, // Distance between points in the data
3, // Dimension in v direction (order)
&ctrlPoints[0][0][0]); // array of control points

// Enable the evaluator
glEnable(GL_MAP2_VERTEX_3);

// Map a grid of 100 points from 0 to 100
glMapGrid2f(10,0.0f,10.0f,10,0.0f,10.0f);
// Evaluate the grid, using lines
glEvalMesh2(GL_LINE,0,10,0,10);
glEnable(GL_AUTO_NORMAL);