NurbsSurface
verb.geom.NurbsSurface
CLASS
A NURBS surface - this class represents the base class of many of verb's surface 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
that respect the You can find further documentation for this type at
https://github.com/jdonaldson/promhx.
Extends: SerializableBase
Implements: ISurface
constructor
METHOD
new NurbsSurface(data : NurbsSurfaceData)
Construct a NurbsSurface by a NurbsSurfaceData object
params
- The data object
returns
- A new NurbsSurface
byKnotsControlPointsWeights
STATIC METHOD
byKnotsControlPointsWeights(degreeU : Int, degreeV : Int, knotsU : KnotArray, knotsV : KnotArray, controlPoints : Array<Array<Point>>, weights : Array<Array<Float>>) : NurbsSurface
Construct a NurbsSurface by degree, knots, control points, weights
params
- The degree in the U direction
- The degree in the V direction
- The knot array in the U direction
- The knot array in the V direction
- Two dimensional array of points
- Two dimensional array of weight values
returns
- A new NurbsSurface
byCorners
STATIC METHOD
byCorners(point0 : Point, point1 : Point, point2 : Point, point3 : Point) : NurbsSurface
Construct a NurbsSurface from four perimeter points in counter-clockwise order
params
- The first point
- The second point
- The third point
- The fourth point
returns
- A new NurbsSurface
byLoftingCurves
STATIC METHOD
byLoftingCurves(curves : Array<ICurve>, degreeV : Int) : NurbsSurface
Construct a NurbsSurface by lofting between a collection of curves
params
- A collection of curves
returns
- A new NurbsSurface
degreeU
METHOD
degreeU() : Int
The degree in the U direction
degreeV
METHOD
degreeV() : Int
The degree in the V direction
knotsU
METHOD
knotsU() : Array<Float>
The knot array in the U direction
knotsV
METHOD
knotsV() : Array<Float>
The knot array in the V direction
controlPoints
METHOD
controlPoints() : Array<Array<Point>>
Two dimensional array of points
weights
METHOD
weights() : Array<Point>
Two dimensional array of weight values
asNurbs
METHOD
asNurbs() : NurbsSurfaceData
Obtain a copy of the underlying data structure for the Surface. Used with verb.core.
returns
- A new NurbsSurfaceData object
clone
METHOD
clone() : NurbsSurface
Obtain a copy of the Surface
returns
- A new NurbsSurface
domainU
METHOD
domainU() : Interval<Float>
The parametric domain in the U direction
returns
- An Interval object with min and max property
domainV
METHOD
domainV() : Interval<Float>
The parametric domain in the V direction
returns
- An Interval object with min and max property
point
METHOD
point(u : Float, v : Float) : Point
Obtain a point on the surface at the given parameter
params
- The u parameter
- The v parameter
returns
- A point on the surface
pointAsync
METHOD
pointAsync(u : Float, v : Float) : Promise<Point>
The async version of point
normal
METHOD
normal(u : Float, v : Float) : Point
Obtain the normal to the surface at the given parameter
params
- The u parameter
- The v parameter
returns
- A normalized vector normal to the surface
normalAsync
METHOD
normalAsync(u : Float, v : Float) : Promise<Array<Array<Vector>>>
The async version of normal
derivatives
METHOD
derivatives(u : Float, v : Float, numDerivs : Int) : Array<Array<Vector>>
Obtain the derivatives of the NurbsSurface. Returns a two dimensional array containing the derivative vectors. Increasing U partial derivatives are increasing row-wise. Increasing V partial derivatives are increasing column-wise. Therefore, the [0][0] position is a point on the surface, [n][0] is the nth V partial derivative, the [1][1] position is twist vector or mixed partial derivative Puv.
params
- The u parameter
- The v parameter
- Number of derivatives to evaluate
returns
- A two dimensional array of vectors
derivativesAsync
METHOD
derivativesAsync(u : Float, v : Float, numDerivs : Int) : Promise<Array<Array<Vector>>>
The async version of derivatives
closestParam
METHOD
closestParam(pt : Point) : UV
Get the closest parameter on the surface to a point
params
- The point
returns
- The closest point
closestParamAsync
METHOD
closestParamAsync(pt : Point) : Promise<UV>
The async version of closestParam
closestPoint
METHOD
closestPoint(pt : Point) : Point
Get the closest point on the surface to a point
params
- The point
returns
- The closest point
closestPointAsync
METHOD
closestPointAsync(pt : Point) : Promise<Point>
The async version of closestParam
split
METHOD
split(u : Float, useV : Bool) : Array<NurbsSurface>
Split a surface
params
- The parameter to do the split
- Whether to divide in V or U
returns
- A length 2 array with two new NurbsSurface objects
splitAsync
METHOD
splitAsync(u : Float, useV : Bool) : Promise<Array<NurbsSurface>>
The async version of split
reverse
METHOD
reverse(useV : Bool) : NurbsSurface
Reverse the parameterization of the curve
params
- False to reverse u, true to reverse v
returns
- The reversed surface
reverseAsync
METHOD
reverseAsync(useV : Bool) : Promise<NurbsSurface>
The async version of reverse
isocurve
METHOD
isocurve(u : Float, useV : Bool) : NurbsCurve
Extract an isocurve from a surface
params
- The parameter at which to obtain the isocurve
- False for a u-iso, true for a v-iso
returns
- A NurbsCurve in the provided direction
isocurveAsync
METHOD
isocurveAsync(u : Float, useV : Bool) : Promise<NurbsCurve>
The async version of isocurve
boundaries
METHOD
boundaries(options : AdaptiveRefinementOptions) : Array<NurbsCurve>
Extract the boundary curves from a surface
returns
- an array containing 4 elements, first 2 curves in the V direction, then 2 curves in the U direction
boundariesAsync
METHOD
boundariesAsync(options : AdaptiveRefinementOptions) : Promise<Array<NurbsCurve>>
The async version of boundaries
tessellate
METHOD
tessellate(options : AdaptiveRefinementOptions) : MeshData
Tessellate the surface
params
- an AdaptiveRefinementOptions object
returns
- A MeshData object
tessellateAsync
METHOD
tessellateAsync(options : AdaptiveRefinementOptions) : Promise<MeshData>
The async version of boundaries
transform
METHOD
transform(mat : Matrix) : NurbsSurface
Transform a Surface with the given matrix.
params
- 4x4 array representing the transform
returns
- A new Surface
transformAsync
METHOD
transformAsync(mat : Matrix) : Promise<NurbsSurface>
The async version of transform