## Re: [PyOpenGL-Users] gluNurbsCurve ?

 Re: [PyOpenGL-Users] gluNurbsCurve ? From: - 2008-12-08 18:10:39 ```Prashant, If N is the number of control points for a spline curve and D is the degree (D = p+1, where p is the order of the polynomials that define the spline functions), and K is the number of knots (knot values, defining the range of the parameter over which the spline is defined), then K = N+D Note that this is differs from the relation given in the ISO/IEC FDIS 19775-1:2008 standard, Sec 27.2.3 (see http://www.web3d.org/x3d/specifications/ISO-IEC-FDIS-19775-1.2-X3D- AbstractSpecification/Part01/components/ nurbs.html#CommonGeometryFieldsAndCorrectness) By my calculations, the relation I have given above is correct* and moreover it works with OpenGL. For most applications, the first D knots are equal to the lowest value of the parameter, and the last D values are equal to the highest value of the parameter, the interior knots (if any) may or may not be equally spaced, but do need to be ordered. For your case, with D=3 and N=5 we need K=8 knot values, for the parameter u from 0 to 1 a valid, equally spaced set of knots is: knots = [0.0,0.0,0.0, 0.33, 0.66, 1.0,1.0,1.0] *If you look at the calculations to evaluate the splines you will find that the first and last knot values are extraneous. However, every API or standard I have examined for NURBS (OpenGL, ISO 10303, "The NURBS Book"...) requires that they be included in the knots vector, and the relation I give above is the one required by the software I have used. Regards, Vince Marchetti ```

 Re: [PyOpenGL-Users] gluNurbsCurve ? From: - 2008-12-08 16:20:09 ```Prashant asked: > I am creating a "gluNurbsCurve" and ripped code is here: > > ... > Using above I am getting a curve which is missing both start and end > points.. (Image1.jpg>Curve 1) > > Your raw code specified a Nurbs curve of order 3 (so polynomial degree 2, a quadratic curve), and set 5 control points. Since the 'knot' attribute was not specified, I assume you relied on the default. Does the code get the behavior you expect if you explicitly specify a "knot" attribute ? ( for example: knot = [0.0,0.0,0.0, 0.33, 0.67, 1.0, 1.0, 1.0] # note: length - 8 list ) Vince Marchetti ```
 Re: [PyOpenGL-Users] gluNurbsCurve ? From: - 2008-12-08 18:10:39 ```Prashant, If N is the number of control points for a spline curve and D is the degree (D = p+1, where p is the order of the polynomials that define the spline functions), and K is the number of knots (knot values, defining the range of the parameter over which the spline is defined), then K = N+D Note that this is differs from the relation given in the ISO/IEC FDIS 19775-1:2008 standard, Sec 27.2.3 (see http://www.web3d.org/x3d/specifications/ISO-IEC-FDIS-19775-1.2-X3D- AbstractSpecification/Part01/components/ nurbs.html#CommonGeometryFieldsAndCorrectness) By my calculations, the relation I have given above is correct* and moreover it works with OpenGL. For most applications, the first D knots are equal to the lowest value of the parameter, and the last D values are equal to the highest value of the parameter, the interior knots (if any) may or may not be equally spaced, but do need to be ordered. For your case, with D=3 and N=5 we need K=8 knot values, for the parameter u from 0 to 1 a valid, equally spaced set of knots is: knots = [0.0,0.0,0.0, 0.33, 0.66, 1.0,1.0,1.0] *If you look at the calculations to evaluate the splines you will find that the first and last knot values are extraneous. However, every API or standard I have examined for NURBS (OpenGL, ISO 10303, "The NURBS Book"...) requires that they be included in the knots vector, and the relation I give above is the one required by the software I have used. Regards, Vince Marchetti ```
 Re: [PyOpenGL-Users] gluNurbsCurve ? From: Prashant Saxena - 2008-12-08 17:27:47 Attachments: Message as HTML ```Thanks, Yes, after explicitly specifying "knot" attribute the curve is drawn properly. Could you please tell me how to calculate knots using degree and number of points? Prashant Your raw code specified a Nurbs curve of order 3 (so polynomial degree 2, a quadratic curve), and set 5 control points. Since the 'knot' attribute was not specified, I assume you relied on the default. Does the code get the behavior you expect if you explicitly specify a "knot" attribute ? ( for example: knot = [0.0,0.0,0.0, 0.33, 0.67, 1.0, 1.0, 1.0] # note: length - 8 list ) Vince Marchetti Download prohibited? No problem. CHAT from any browser, without download. Go to http://in.webmessenger.yahoo.com/```