Search code examples
copenglcurvenurbs

OpenGL Nurbs: finding knot coordinates


I need to draw the control points and knots of a NURBS curve, in OpenGL. The control points are no problem, as they are defined by their coordinates. I'm having a bit more trouble with the knots, however.

I have an array of knots as taken by the gluNurbsCurve function, defined as follows.

GLfloat knots[KNOTCOUNT] = {0.00, 0.00, 0.00,
                            0.25,
                            0.50, 0.50,
                            0.75,
                            1.00, 1.00, 1.00}

Is there an easy method to derive the coordinates of these 5 knots? Based on the coordinates of the control points, I assume? Or is this non-trivial? Other than the coordinates and weights of the control points, I also have the STRIDE and ORDER values.

I figured it would be possible, since the gluNurbsCurve-function is able to draw the curve based on these values..

Or am I missing the concept of knots entirely?


Solution

  • If you read the article you posted on NURBS you will learn that the knots are more of a weight than a point.

    "The knot vector is a sequence of parameter values that determines where and how the control points affect the NURBS curve."

    So at best a knot can be represented as an area of the curve. What you can though easly visualize it the multiplicity of a knot. Simply color the associated control points it apropriatly.