nurbsCurve.insertKnot
The same curve with knot t inserted times times: more control points, the shape unchanged.
Usage
curve.insertKnot(t: number, times?: number): Result<NurbsCurve>Parameters
tnumberThe knot value to insert, inside the domain (ends included).
timesnumberHow many copies to insert; a non-negative integer (fractions are truncated, 0 is a no-op). Default
1. In count.
Returns
Ok with a curve of pointCount + times control points and the same domain.
Errors
Guarantees
- result.pointCount === pointCount + times
- result.pointAt(s) is within 1e-12 of pointAt(s) for every s (Point3.distance)
- the knot vector gains times copies of t
- The same result on every machine.
Example
const q = NurbsCurve.create([Point3.of(1, 0, 0), Point3.of(1, 1, 0), Point3.of(0, 1, 0)], 2, { weights: [1, Math.SQRT1_2, 1], knots: [0, 0, 0, 1, 1, 1] }).value
const r = q.insertKnot(0.4, 2) // → 5 control points, same shape, once loadGeometryKernel() has run