# Tess

`verb.eval.Tess`

CLASS

Source code

`Tess` contains static, immutable algorithms for tessellation of NURBS curves and sufaces. Tessellation is the decomposition of the analytical NURBS representation into discrete meshes or polylines that are useful for drawing.

Some of these algorithms are "adaptive" - using certain heuristics to sample geometry where such samples make sense - while others are "regular" in that they sample regularly throughout a parametric domain. There are tradeoffs here. While adaptive algorithms can sometimes yield "better" results that are smaller or more economical, this can sometimes come at increased computational cost. For example, it is sometimes necessarily to compute higher order derivatives in order to obtain these more economical results. Your usage of these algorithms should consider these tradeoffs.

## rationalCurveRegularSample

STATIC METHOD

Source code

`rationalCurveRegularSample(curve : NurbsCurveData, numSamples : Int, includeU : Bool) : Array<Point>`

Sample a NURBS curve at equally spaced parametric intervals

params

• NurbsCurveData object
• integer number of samples
• whether to prefix the point with the parameter

returns

• an array of points, prepended by the point param if required

## rationalCurveRegularSampleRange

STATIC METHOD

Source code

`rationalCurveRegularSampleRange(curve : NurbsCurveData, start : Float, end : Float, numSamples : Int, includeU : Bool) : Array<Point>`

Sample a range of a NURBS curve at equally spaced parametric intervals

params

• NurbsCurveData object
• start parameter for sampling
• end parameter for sampling
• integer number of samples
• whether to prefix the point with the parameter

returns

• an dictionary of parameter - point pairs

STATIC METHOD

Source code

`rationalCurveAdaptiveSample(curve : NurbsCurveData, tol : Float, e-6 : undefined, includeU : Bool) : Array<Point>`

Sample a NURBS curve over its entire domain, corresponds to this algorithm

params

• NurbsCurveData object
• tol for the adaptive scheme
• whether to prefix the point with the parameter

returns

• an array of dim + 1 length where the first element is the param where it was sampled and the remaining the pt

STATIC METHOD

Source code

`rationalCurveAdaptiveSampleRange(curve : NurbsCurveData, start : undefined, end : undefined, tol : undefined, includeU : undefined) : Array<Point>`

Sample a NURBS curve at 3 points, facilitating adaptive sampling

params

• NurbsCurveData object
• start parameter for sampling
• end parameter for sampling
• whether to prefix the point with the parameter

returns

• an array of dim + 1 length where the first element is the param where it was sampled and the remaining the pt

## rationalSurfaceNaive

STATIC METHOD

Source code

`rationalSurfaceNaive(surface : NurbsSurfaceData, divs_u : Int, divs_v : Int) : MeshData`

Tessellate a NURBS surface on equal spaced intervals in the parametric domain

params

• NurbsSurfaceData object
• number of divisions in the u direction
• number of divisions in the v direction

returns

• MeshData object

STATIC METHOD

Source code

`divideRationalSurfaceAdaptive(surface : NurbsSurfaceData, options : AdaptiveRefinementOptions) : Array<AdaptiveRefinementNode>`

Divide a NURBS surface int equal spaced intervals in the parametric domain as AdaptiveRefinementNodes

params

• NurbsSurfaceData object
• SurfaceDivideOptions object

returns

• MeshData object

STATIC METHOD

Source code

`rationalSurfaceAdaptive(surface : NurbsSurfaceData, options : AdaptiveRefinementOptions) : MeshData`

`verb.eval.AdaptiveRefinementOptions`

CLASS

Source code

## constructor

METHOD

Source code

`new AdaptiveRefinementOptions()`

## normTol

PROPERTY

Source code

`normTol : Float`

## minDepth

PROPERTY

Source code

`minDepth : Int`

## maxDepth

PROPERTY

Source code

`maxDepth : Int`

## refine

PROPERTY

Source code

`refine : Bool`

## minDivsU

PROPERTY

Source code

`minDivsU : Int`

## minDivsV

PROPERTY

Source code

`minDivsV : Int`

`verb.eval.AdaptiveRefinementNode`

CLASS

Source code

``````Structure of the child nodes
in the adaptive refinement tree

v
^
|
+--> u

neighbors

(u0,v1)---(u05,v1)---(u1,v1)
|           |          |
|     3     |     2    |
|           |          |
neighbors   (u0,v05)--(u05,v05)--(u1,v05)   neighbors
|           |          |
|     0     |     1    |
|           |          |
(u0,v0)---(u05,v0)---(u1,v0)

neighbors
``````

## constructor

METHOD

Source code

`new AdaptiveRefinementNode(srf : NurbsSurfaceData, corners : Array<SurfacePoint>, neighbors : Array<AdaptiveRefinementNode>)`

## isLeaf

METHOD

Source code

`isLeaf()`

## center

METHOD

Source code

`center()`

## evalCorners

METHOD

Source code

`evalCorners()`

## evalSrf

METHOD

Source code

`evalSrf(u : Float, v : Float, srfPt : SurfacePoint) : SurfacePoint`

## getEdgeCorners

METHOD

Source code

`getEdgeCorners(edgeIndex : Int) : Array<SurfacePoint>`

## getAllCorners

METHOD

Source code

`getAllCorners(edgeIndex : Int) : Array<SurfacePoint>`

## midpoint

METHOD

Source code

`midpoint(index : undefined)`

METHOD

Source code

`hasBadNormals() : Bool`

## fixNormals

METHOD

Source code

`fixNormals() : Void`

## shouldDivide

METHOD

Source code

`shouldDivide(options : AdaptiveRefinementOptions, currentDepth : Int)`

## divide

METHOD

Source code

`divide(options : AdaptiveRefinementOptions) : Void`

## triangulate

METHOD

Source code

`triangulate(mesh : MeshData) : MeshData`

## triangulateLeaf

METHOD

Source code

`triangulateLeaf(mesh : MeshData) : MeshData`

## neighbors

PROPERTY

Source code

`neighbors : Array<AdaptiveRefinementNode>`