2

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?

Joost
  • 4,094
  • 3
  • 27
  • 58
  • I would recommend you to draw the knots separately, as 5 little squares. – Ivan Kuckir Oct 14 '12 at 21:14
  • That is my every intention. Still, I do not have the x and y coordinates of said knots. – Joost Oct 14 '12 at 21:20
  • You have a 10 float array in your question. Each 2 floats are X and Y coordinates of a knot, am I right? – Ivan Kuckir Oct 14 '12 at 21:24
  • Nope. The `gluNurbsCurve` function takes an array of knots in ascending order, where multiple occurance of one knot defines multiplicity of a single knot. The knot vector is described [here on Wikipeida](http://en.wikipedia.org/wiki/Non-uniform_rational_B-spline#The_knot_vector) – Joost Oct 14 '12 at 21:28

2 Answers2

2

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.

rioki
  • 5,988
  • 5
  • 32
  • 55
  • You were right, my concept of knots was a bit off. I've taken a command-line approach for editing the knot vector, rather than visualising. – Joost Oct 23 '12 at 08:39
1

Take a look at this webpage: http://www.ibiblio.org/e-notes/Splines/Basis.htm

It gives a good explanation of knot-vectors and even let you try to play with the knot-vectors in an Java-applet (move the small knots on top of the right side of the figures). Source code for the Java-applets is also available.

The page is a part of a full interactive introduction to splines: http://www.ibiblio.org/e-notes/Splines/Intro.htm

Mortennobel
  • 3,383
  • 4
  • 29
  • 46