====== What does NURBS mean and why should I care? ====== =====More details===== http://en.wikipedia.org/wiki/NURBS =====Non-Uniform Rational B-Spline (NURBS)===== What are //NURBS//? The word NURBS is an acronym for non-uniform rational B-spline. Non uniform rational B-splines can represent 3D geometry. =====Why use NURBS to represent 3D geometry?===== NURBS geometry has five important qualities that make it an ideal choice for computer aided modeling. * There are several industry standard ways to exchange NURBS geometry. This means that customers can and should expect to be able to move their valuable geometric models between various modeling, rendering, animation, and engineering analysis programs. They can store geometric information in a way that will be usable 20 years from now. * NURBS has a precise and well-known definition. Most major universities teach the mathematics and computer science of NURBS geometry. This means that specialty software vendors, engineering teams, industrial design firms, and animation houses that need to create custom software applications, can find trained programmers able to work with NURBS geometry. * NURBS accurately represents both standard geometric objects like lines, circles, ellipses, spheres, and tori, and free-form geometry like car bodies and human bodies. * The amount of information required for a NURBS representation of a piece of geometry is much smaller than the amount of information required by common faceted approximations. * The NURBS evaluation rule, discussed below, can be implemented on a computer efficiently and accurately. =====What is NURBS geometry?===== There are lots of ways to answer this question. If you are comfortable reading mathematical formulae, you can get more detailed information at the **Books and papers on NURBS** section at the **[[developer:opennurbs:home|openNURBS]] web site**. Rhino uses NURBS to represent curves and surfaces. NURBS curves and surfaces behave in similar ways and share a lot of terminology. Since curves are easiest to describe, we’ll cover them in detail. Rhino has surface tools that are analogous to the curve tools mentioned below. A NURBS curve is defined by four things: **degree, control points, knots, and an evaluation rule**. The **degree** is a positive whole number. This number is usually 1, 2, 3 or 5. Rhino lines and polylines are degree 1. Rhino circles are degree 2. And most Rhino free-form curves are degree 3 or 5. Rhino will let you work with NURBS that have degrees from 1 to 32. Sometimes the terms linear, quadratic, cubic, and quintic are used. Linear means degree 1, quadratic means degree 2, cubic means degree 3, and quintic means degree 5. You may see references to the order of a NURBS curve. The order of a NURBS curve is positive whole number equal to (degree+1). Consequently, the degree is equal to order-1. It is possible to increase the degree of a NURBS curve and not change its shape. It is not possible to reduce a NURBS curve’s degree without changing its shape. Rhino provides tools that can change degrees to any value in the range from 1 to 32. The **control points** are a list of at least (degree+1) points. One of easiest ways to change the geometry of a NURBS curve is to move its control points. Rhino provides several ways to move control points. To perform large free-form adjustments you simply use the mouse to drag the control point. Rhino provides other tools tailored for small precise adjustments. The control points have an associated number called a **weight**. With a few exceptions, weights are positive numbers. When a curve’s control points all have the same weight (usually 1), the curve is non-rational. Otherwise the curve is called rational. The R in NURBS stands for rational and indicates that a NURBS curve has the possibility of being rational. In practice, most NURBS curves are non-rational. A few NURBS curves, circles and ellipses being notable examples, are always rational. Rhino provides tools for examining and changing control point weights. The **knots** are a list of degree+N-1 numbers, where N is the number of control points. Sometimes this list of numbers is called the knot vector. In this term, the word vector does not mean 3D direction. This list of knot numbers must satisfy several technical conditions. The standard way to satisfy the technical conditions is to require the numbers to stay the same or get larger as you go down the list and to limit the number of duplicate values to no more than the degree. For example, for a degree 3 NURBS curve with 11 control points: * The list of numbers 0,0,0,1,2,2,2,3,7,7,9,9,9 is a satisfactory list of knots. * The list 0,0,0,1,2,2,2,2,7,7,9,9,9 is unacceptable because there are four 2s and four is larger than the degree. The number of times a knot value is duplicated is the **knot’s multiplicity**. In the preceding example of a satisfactory list of knots, the knot value 0 has multiplicity three, the knot value 1 has multiplicity one, the knot value 2 has multiplicity three, the knot value 7 has multiplicity two, and the knot value 9 has multiplicity three. A knot value is a full multiplicity knot if it is duplicated many times. In the example, the knot values 0, 2, and 9 have full multiplicity. A knot value that appears only once is a simple knot. In the example the knot values 1 and 3 are simple knots. If a list of knots starts with a full multiplicity knot, is followed by simple knots, terminates with a full multiplicity knot, and the values are equally spaced, then the knots are uniform. For example, if a degree 3 NURBS curve with 7 control points has knots 0,0,0,1,2,3,4,4,4, then the curve has uniform knots. The knots 0,0,0,1,2,5,6,6,6 are not uniform. Knots that are not uniform are called non uniform. The NU in NURBS stands for non uniform and indicates that the knots in a NURBS curve are permitted to be non-uniform. Duplicate knot values in the middle of the knot list make a NURBS curve less smooth. At the extreme, a full multiplicity knot in the middle of the knot list means there is a place on the NURBS curve that can be bent into a sharp kink. For this reason, some designers like to add and remove knots and then adjust control points to make curves smoother or kinkier. Rhino has tools for removing and adding knots. Since the number of knots is equal to (N+degree 1), where N is the number of control points, adding knots also adds control points and removing knots removes control points. Knots can be added without changing the shape of a NURBS curve. In general, removing knots will change the shape of a curve. Rhino provides an advanced knot removing interface that automatically performs appropriate knot removal when you delete a control point. A common misconception is that each knot is paired with a control point. This is true only for degree 1 NURBS (polylines). For higher degree NURBS, there are groups of 2 x degree knots that correspond to groups of degree+1 control points. For example, suppose we have a degree 3 NURBS with 7 control points and knots 0,0,0,1,2,5,8,8,8. * The first four control points are grouped with the first six knots. * The second through fifth control points are grouped with the knots 0,0,1,2,5,8. * The third through sixth control points are grouped with the knots 0,1,2,5,8,8. * The last four control points are grouped with the last six knots. Some modelers that use older algorithms for NURBS evaluation require two extra knot values for a total of degree+N+1 knots. When Rhino is exporting and importing NURBS geometry, if needed, it automatically adds and removes these two superfluous knots. The **evaluation rule** uses a mathematical formula that takes a number and assigns a point. The formula involves the degree, control points, and knots. In the formula there are some things called B-spline basis functions. The BS in NURBS stands for B-spline. The number the evaluation rule starts with is called a parameter. You can think of the evaluation rule as a black box that eats a parameter and produces a point. The degree, knots, and control points determine how the black box works. Rhino has evaluation tools. You can select a NURBS curve, type in the value of the parameter, and produce the corresponding point. Conceptually, the knots determine the B-spline basis functions. The values of the B-spline basis functions at the parameter determine how the control points and weights are averaged together to produce a point. Detailed discussions of the evaluation rule and B-spline basis functions are available in many textbooks and web pages.