nurbsCurve.removeKnot

The curve with up to times copies of knot t removed, where the shape moves by at most tolerance × the control net’s extent.

GeometricSince 0.4.0

Usage

TypeScript
curve.removeKnot(t: number, times?: number, tolerance?: number): Result<NurbsCurve>

Parameters

  • tnumber

    An interior knot of the vector.

    Required

  • timesnumber

    How many copies to remove at most; a non-negative integer (fractions are truncated, 0 is a no-op). Default 1. In count.

  • tolerancenumber

    How far the shape may move, as a fraction of the control net’s bounding-box diagonal; finite and ≥ 0. Default 1e-9. In normalised.

Returns

Ok with the curve after the removals that stayed within tolerance — possibly fewer than times, possibly none (an unchanged copy). It is not a failure when nothing could be removed: compare pointCount before and after to see how many copies came out.

Errors

Guarantees

  • pointCount − result.pointCount copies were removed, between 0 and times
  • result.pointAt(s) is within tolerance × the control net’s bounding-box diagonal of pointAt(s) for every s (a rigorous bound, up to rounding)
  • removing what insertKnot added returns the original pointCount
  • The same result on every machine.

Example

TypeScript
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.removeKnot(0.5) // → GEOMETRY_OP_FAILED (NotAKnot) once loadGeometryKernel() has run: 0.5 is not a knot of q

See also