nurbsCurve.create
A NURBS curve from control points and a degree, with optional weights and knots, checked by the kernel’s rules.
Usage
NurbsCurve.create(points: readonly Point3[], degree: number, options?: { weights?: readonly number[]; knots?: readonly number[] }): Result<NurbsCurve>Parameters
pointsreadonly Point3[]Euclidean control points, more than degree of them. Required. In model.
degreenumberThe polynomial degree p, an integer in 1 … 16. Required. In count.
options.weightsreadonly number[]One weight per control point, finite and > 0 (not subnormal). Default
all 1.options.knotsreadonly number[]points.length + degree + 1 non-decreasing knots; their values are the curve’s parameters. Default
clamped uniform on [0, 1].
Returns
Ok with a frozen curve. Getters: pointCount, domain (the knot interval [knots[p], knots[n]]) and isRational (some weight differs from the first).
Errors
Guarantees
- pointAt(domain.t0) is the first control point and pointAt(domain.t1) the last for clamped knots (end knots repeated p + 1 times)
- the stored arrays are copies: points, weights and knots of the result equal the input
- The same result on every machine.
Example
const c = NurbsCurve.create([Point3.of(0, 0, 0), Point3.of(2, 0, 0), Point3.of(2, 2, 0)], 2, { knots: [3, 3, 3, 5, 5, 5] }).value
c.domain // → { t0: 3, t1: 5 }