# Modify

`verb.eval.Modify`

CLASS

Source code

`Modify` contains many fundamental algorithms for working with NURBS. These include algorithms for:

• knot insertion
• knot refinement
• decomposition into bezier's
• degree elevation
• reparameterization

Many of these algorithsm owe their implementation to Piegl & Tiller's, "The NURBS Book"

## curveReverse

STATIC METHOD

Source code

`curveReverse(curve : NurbsCurveData) : NurbsCurveData`

Reverses the parameterization of a NURBS curve. The domain is unaffected.

params

• A NURBS curve to be reversed

returns

• A new NURBS curve with a reversed parameterization

## surfaceReverse

STATIC METHOD

Source code

`surfaceReverse(surface : NurbsSurfaceData, useV : Bool) : NurbsSurfaceData`

Reverse the parameterization of a NURBS surface in the specified direction. The domain is unaffected.

params

• A NURBS surface to be reversed
• Whether to use the U direction or V direction

returns

• A new NURBS surface with a reversed parameterization in the given direction

## knotsReverse

STATIC METHOD

Source code

`knotsReverse(knots : KnotArray) : KnotArray`

Reverse a knot vector

params

• An array of knots

returns

• The reversed array of knots

## unifyCurveKnotVectors

STATIC METHOD

Source code

`unifyCurveKnotVectors(curves : Array<NurbsCurveData>) : Array<NurbsCurveData>`

Unify the knot vectors of a collection of NURBS curves. This can be used, for example, is used for lofting between curves.

params

• An array of NURBS curves

returns

• A collection of NURBS curves, all with the same knot vector

## curveElevateDegree

STATIC METHOD

Source code

`curveElevateDegree(curve : NurbsCurveData, finalDegree : Int) : NurbsCurveData`

Elevate the degree of a NURBS curve

params

• The curve to elevate
• The expected final degree

returns

• The NURBS curve after degree elevation - if the supplied degree is <= the curve is returned unmodified

## rationalSurfaceTransform

STATIC METHOD

Source code

`rationalSurfaceTransform(surface : NurbsSurfaceData, mat : Matrix) : NurbsSurfaceData`

Transform a NURBS surface using a matrix

params

• The surface to transform
• The matrix to use for the transform - the dimensions should be the dimension of the surface + 1 in both directions

returns

• A new NURBS surface after transformation

## rationalCurveTransform

STATIC METHOD

Source code

`rationalCurveTransform(curve : NurbsCurveData, mat : Matrix) : NurbsCurveData`

Transform a NURBS curve using a matrix

params

• The curve to transform
• The matrix to use for the transform - the dimensions should be the dimension of the curve + 1 in both directions

returns

• A new NURBS surface after transformation

## surfaceKnotRefine

STATIC METHOD

Source code

`surfaceKnotRefine(surface : NurbsSurfaceData, knotsToInsert : Array<Float>, useV : Bool) : NurbsSurfaceData`

Perform knot refinement on a NURBS surface by inserting knots at various parameters

params

• The surface to insert the knots into
• The knots to insert - an array of parameter positions within the surface domain
• Whether to insert in the U direction or V direction of the surface

returns

• A new NURBS surface with the knots inserted

## decomposeCurveIntoBeziers

STATIC METHOD

Source code

`decomposeCurveIntoBeziers(curve : NurbsCurveData) : Array<NurbsCurveData>`

Decompose a NURBS curve into a collection of bezier's. Useful as each bezier fits into it's convex hull. This is a useful starting point for intersection, closest point, divide & conquer algorithms

params

• NurbsCurveData object representing the curve

returns

• Array of NurbsCurveData objects, defined by degree, knots, and control points

## curveKnotRefine

STATIC METHOD

Source code

`curveKnotRefine(curve : NurbsCurveData, knotsToInsert : Array<Float>) : NurbsCurveData`

Insert a collection of knots on a curve

Corresponds to Algorithm A5.4 (Piegl & Tiller)

params

• NurbsCurveData object representing the curve
• array of knots to insert

returns

• NurbsCurveData object representing the curve

## curveKnotInsert

STATIC METHOD

Source code

`curveKnotInsert(curve : NurbsCurveData, u : Float, r : Int) : NurbsCurveData`

Insert a knot along a rational curve. Note that this algorithm only works for r + s <= degree, where s is the initial multiplicity (number of duplicates) of the knot.

Corresponds to algorithm A5.1 (Piegl & Tiller)

Use the curveKnotRefine for applications like curve splitting.

params

• integer degree
• array of nondecreasing knot values
• array of control points
• parameter at which to insert the knot
• number of times to insert the knot

returns

• Object the new curve, defined by knots and controlPoints