NurbsCurve

verb.geom.NurbsCurve

CLASS

Source code

A NURBS curve - this class represents the base class of many of verb.geom's curve types and provides many tools for analysis and evaluation. This object is deliberately constrained to be immutable. The methods to inspect the properties of this class deliberately return copies. asNurbs can be used to obtain a simplified NurbsCurveData object that can be used with verb.core or for serialization purposes.

Under the hood, this type takes advantage of verb's asynchronous runtime using the _Async methods. Calling one of these methods returns a Promise instead of the value. This allows you to run the computation in a background thread and obtain the value asynchronously.

You can find further documentation for using Promise's at https://github.com/jdonaldson/promhx.

Extends: SerializableBase

Implements: ICurve

constructor

METHOD

Source code

new NurbsCurve(data : NurbsCurveData)

Construct a NurbsCurve by a NurbsCurveData object

params

returns

byKnotsControlPointsWeights

STATIC METHOD

Source code

byKnotsControlPointsWeights(degree : Int, knots : KnotArray, controlPoints : Array<Point>, weights : Array<Float>) : NurbsCurve

Construct a NurbsCurve by degree, knots, control points, weights

params

returns

byPoints

STATIC METHOD

Source code

byPoints(points : Array<Point>, degree : Int) : NurbsCurve

Construct a NurbsCurve by interpolating a collection of points. The resultant curve will pass through all of the points.

params

returns

degree

METHOD

Source code

degree() : Int

The degree of the curve

knots

METHOD

Source code

knots() : KnotArray

The knot array

controlPoints

METHOD

Source code

controlPoints() : Array<Point>

Array of control points

weights

METHOD

Source code

weights() : Array<Float>

Array of weight values

asNurbs

METHOD

Source code

asNurbs() : NurbsCurveData

Obtain a copy of the underlying data structure for the Curve. Used with verb.core.

returns

clone

METHOD

Source code

clone()

Obtain a copy of the curve

returns

domain

METHOD

Source code

domain() : Interval<Float>

Determine the valid domain of the curve

returns

transform

METHOD

Source code

transform(mat : Matrix) : NurbsCurve

Transform a curve with the given matrix.

params

returns

transformAsync

METHOD

Source code

transformAsync(mat : Matrix) : Promise<NurbsCurve>

The async version of transform

point

METHOD

Source code

point(u : Float) : Point

Sample a point at the given parameter

params

returns

pointAsync

METHOD

Source code

pointAsync(u : Float) : Promise<Point>

The async version of point

tangent

METHOD

Source code

tangent(u : Float) : Vector

Obtain the curve tangent at the given parameter. This is the first derivative and is not normalized

params

returns

tangentAsync

METHOD

Source code

tangentAsync(u : Float) : Promise<Vector>

The async version of tangent

derivatives

METHOD

Source code

derivatives(u : Float, numDerivs : Int) : Array<Vector>

Get derivatives at a given parameter

params

returns

derivativesAsync

METHOD

Source code

derivativesAsync(u : Float, numDerivs : Int) : Promise<Array<Vector>>

The async version of derivatives

closestPoint

METHOD

Source code

closestPoint(pt : Point) : Point

Determine the closest point on the curve to the given point

params

returns

closestPointAsync

METHOD

Source code

closestPointAsync(pt : Point) : Promise<Point>

The async version of closestPoint

closestParam

METHOD

Source code

closestParam(pt : Point) : Float

Determine the closest parameter on the curve to the given point

params

returns

closestParamAsync

METHOD

Source code

closestParamAsync(pt : Dynamic) : Promise<Point>

The async version of length

length

METHOD

Source code

length() : Float

Determine the arc length of the curve

returns

lengthAsync

METHOD

Source code

lengthAsync() : Promise<Float>

The async version of length

lengthAtParam

METHOD

Source code

lengthAtParam(u : Float) : Float

Determine the arc length of the curve at the given parameter

params

returns

lengthAtParamAsync

METHOD

Source code

lengthAtParamAsync() : Promise<Float>

The async version of lengthAtParam

paramAtLength

METHOD

Source code

paramAtLength(len : Float, tolerance : Float) : Float

Determine the parameter of the curve at the given arc length

params

returns

paramAtLengthAsync

METHOD

Source code

paramAtLengthAsync(len : Float, tolerance : Float) : Promise<Float>

The async version of paramAtLength

divideByEqualArcLength

METHOD

Source code

divideByEqualArcLength(divisions : Int) : Array<CurveLengthSample>

Determine the parameters necessary to divide the curve into equal arc length segments

params

returns

divideByEqualArcLengthAsync

METHOD

Source code

divideByEqualArcLengthAsync(divisions : Int) : Promise<Array<CurveLengthSample>>

The async version of `divideByEqualArcLength``

divideByArcLength

METHOD

Source code

divideByArcLength(arcLength : Float) : Array<CurveLengthSample>

Given the distance to divide the curve, determine the parameters necessary to divide the curve into equal arc length segments

params

returns

divideByArcLengthAsync

METHOD

Source code

divideByArcLengthAsync(divisions : Int) : Promise<Array<CurveLengthSample>>

The async version of divideByArcLength

split

METHOD

Source code

split(u : Float) : Array<NurbsCurve>

Split the curve at the given parameter

params

returns

splitAsync

METHOD

Source code

splitAsync(u : Float) : Promise<Array<NurbsCurve>>

The async version of split

reverse

METHOD

Source code

reverse() : NurbsCurve

Reverse the parameterization of the curve

returns

reverseAsync

METHOD

Source code

reverseAsync() : Promise<NurbsCurve>

The async version of reverse

tessellate

METHOD

Source code

tessellate(tolerance : Float) : Array<Point>

Tessellate a curve at a given tolerance

params

returns

tessellateAsync

METHOD

Source code

tessellateAsync(tolerance : Float) : Promise<Array<Point>>

The async version of tessellate