# Knots in opengl nurbs

I have the points on the outside of an object.  This object is a distorted cylinder in shape, and there are 40 points in it. I want to make a nurbs surface from theses points, but cannot figure out what the knots are or how to compute them.  All the examples I can find have an array of even size (how do they find this size??) containing half zeros and half ones {0,0,0,1,1,1) for example.  Trying random knot arrays either draws nothing at all or a very strange shape that passes through 2 or more points from the object but looks like a wadded up piece of paper.  Also, do the points in the object need to be in some specific order?  Should the object be drawn with 2 nurbs (all examples are a distorted plane, not cylindrical)??
Thanks...

LVL 2
###### Who is Participating?

Commented:
It's too bad you don't want to sit down with a book for this one, but if cost is the only concern then a you may find a library useful :)

Anyways, a cubic b-spline needs a minimum of four knots to start, anything beyond four is where you'll start to see a reasonable surface.  There is no maximum number of knots.   In general, three knots to correspond to you first geometric control point, three for the last and one for each in between.

Just a caveat, NURBS are quite prone to problems such as tearing and catastrophic cusping, so they are really only appropriate for open surfaces.  For a complex model that has closed surfaces, you may find the results dissappointing.
0

Commented:
I suggest that as knots are a fairly fundamental concept to b-splines (including NURBS), you may want to pickup a graphics  or computational geometry textbook.  It's a classic topic, so there should be no sortage of good references.  I'll try and give an explanatation here, but it's the sort of thing that's much easier when you have some pictures to go with it.

The knots are essentially points in a space where the b-spline basis functions are evaluated.  The results of the basis functions over the knots mapped to the rendering space is what gives the b-spline or b-spline surface.

The array that you bring up is that of the knot indeces.  For n knots, you could use the sequence {0, 0, 0, 1, 2, ..., k-1, k-1, k-1}.

---

As an aside, it's my opinion that NURBS are seriously constraining and outdated.  There are far better and easier solutions to creating nice surfaces, my favourite technique being subdivision.
0

Author Commented:
I have books, but they do not explain it well. (math and what a knot is in those terms, but not how to pick them or how many to use). I'm not buying another just for this; I only do graphics about one week a year =)
So how many knots are needed? Gl will not draw anything unless the right number of knots is used.

My object was a bajillion triangles from 3d max, I was going to try a nurbs to improve performance (just to see) before trying to decrease the triangles in max.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.