nurbsSurface.tessellate

A quad mesh of the surface sampled on a uniform uDivs × vDivs parameter grid.

GeometricSince 0.4.0

Usage

TypeScript
surface.tessellate(uDivs?: number, vDivs?: number): Result<Mesh>

Parameters

  • uDivsnumber

    Intervals along u; an integer. Default 32. Range [1, 2048] count.

  • vDivsnumber

    Intervals along v; an integer. Default 32. Range [1, 2048] count.

Returns

Ok with a mesh of (uDivs + 1)(vDivs + 1) points at evenly spaced knot parameters and uDivs · vDivs quads, positions in f64. The grid is not welded: seams and poles keep duplicate points, so a closed surface gives an open mesh.

Errors

Guarantees

  • every mesh point equals pointAt at its grid parameters to rounding
  • mesh.area() converges to the exact area as the divisions grow, with error O(1/n²) (a unit sphere: 0.86 at 8 × 8, 0.0035 at 128 × 128, against 4π)
  • faces follow the surface’s normal side (the sphere’s face normals point outward)
  • The same result on every machine.

Example

TypeScript
const r = NurbsSurface.sphere(1) // CAPABILITY_UNAVAILABLE until loadGeometryKernel() has run
const m = r.ok ? r.value.tessellate(128, 128) : r // → area ≈ 4π − 0.0035

See also