문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top