![](https://csdnimg.cn/release/download_crawler_static/2112044/bg1.jpg)
An introduction to NURBS
++
Philippe Lavoie
April 28, 1999
NURBS
++
is available from the web at http://yukon.genie.uottawa.ca/ lavoie/software/nurbs. It offers classes to
represent NURBS curves and surfaces along with many functions to help manipulate them. For interactive design
purposes it also has OpenGL wrappers.
This document focuses on how to use the library to perform elementary tasks. It doesn’t not discuss the theoret-
ical aspects of NURBS curves and surfaces. From the link above you will be able to find documents which explain
more the mathematical and theoretical aspects of NURBS curves and surfaces.
This document is not a replacement for the reference manual. Most of the function are shown here with a brief
introduction but for a more complete description of the input and output values you should refer to the reference
manual. The reference manual can be found from the link mentionned above.
I will also admit that I spend more time on the source code than on the documentation. Therefore for the truly
latest documentation, nothing beats the source code. However, I will incorporate into this document any changes
proposed by a reader.
1 The basic types
NURBS curves and surfaces are represented using knot vectors and control points. Since the library uses templates,
it is up to the user to define if he/she prefers to perform the computation using float or double float precision. The
dimension domain can also be changed, i.e. 2D or 3D curves. A the time of writing, no efforts were made to obtain
a 2D surface. To specify the precision and the dimension, change the mentions of <T,D> that follows in the text
with <float,3>, with <double,3>, with <float,2> or with <double,2>.
A control point is of type HPoint_nD<T,D> which stands for Homogenous point. A knot vector is of type
Vector<T>. By extension, a vector of control points is of type Vector<HPoint_nD<T,D> >. In the case of
a surface, a matrix of Control points is used (Matrix<HPoint_nD<T,D> >). A NURBS curve or surface can
be evaluated in normal space and the result is returns is a Point_nD<T,D> Finally, a NURBS curve is referred
to as NurbsCurve<T,D> and a NURBS surface as NurbsSurface<T,D>.
Every classes defined by NURBS
++
are declared inside the PLib namespace. To save you some typing, you
can either add a using namespace PLib; at the begining of your files or alternatively you can use one of the
typedefs provided by the library. These typedefs are the following:
2 NURBS curve
There are different methods to initialize a NURBS curve: from a list of points in 3D or 4D, by copying, or by
leaving it empty. If you leave a NURBS curve empty you must realize that it has not been initialized properly and
therefore shouldn’t be used to compute anything useful (any such attempt will result in an error message).
It should be noted that at the initialization stage, the value provided is the value given to the control points. It
doesn’t mean that the curve will go through these points. If you want the later, you will need to use a routine that
interpolates between those points.
Here is an example on how to initialize a NURBS curve with known control points values and a known knot
vector.
1