nurbsSurface.create

A NURBS surface from a grid of control points and two degrees, with optional weights and knots, checked by the kernel’s rules.

GeometricSince 0.4.0

Usage

TypeScript
NurbsSurface.create(net: readonly (readonly Point3[])[], degreeU: number, degreeV: number, options?: { weights?: readonly (readonly number[])[]; knotsU?: readonly number[]; knotsV?: readonly number[] }): Result<NurbsSurface>

Parameters

  • netreadonly (readonly Point3[])[]

    net[i][j]: row i along u, column j along v; every row the same length. Required. In model.

  • degreeUnumber

    Degree along u, an integer in 1 … 16, below the row count. Required. In count.

  • degreeVnumber

    Degree along v, an integer in 1 … 16, below the column count. Required. In count.

  • options.weightsreadonly (readonly number[])[]

    A weight per control point, the same grid, finite and > 0. Default all 1.

  • options.knotsUreadonly number[]

    rows + degreeU + 1 knots along u. Default clamped uniform on [0, 1].

  • options.knotsVreadonly number[]

    cols + degreeV + 1 knots along v. Default clamped uniform on [0, 1].

Returns

Ok with a frozen surface: degreeU, degreeV, rows, cols, points (row-major), weights, knotsU, knotsV. Getters domainU and domainV give the knot intervals.

Errors

Guarantees

  • controlPoint(i, j) equals net[i][j]
  • for clamped knots the corners interpolate: pointAt(domainU.t0, domainV.t0) = net[0][0]
  • The same result on every machine.

Example

TypeScript
const s = NurbsSurface.create([[Point3.of(0, 0, 0), Point3.of(0, 2, 0)], [Point3.of(3, 0, 0), Point3.of(3, 2, 0)]], 1, 1).value
s.pointAt(0.5, 0.5) // → { x: 1.5, y: 1, z: 0 }

See also