nurbsCurve.length
The arc length between two knot parameters, by Gauss–Legendre quadrature.
Usage
curve.length(from?: number, to?: number): numberParameters
fromnumberStart parameter, in knot units. Default
domain.t0.tonumberEnd parameter, in knot units; from and to may be given in either order. Default
domain.t1.
Returns
A non-negative length in model units; 0 when from = to; NaN for a NaN bound. Bounds outside the domain are clamped to it, as pointAt clamps.
Guarantees
- a circle of radius r has length 2πr to about 1e-15 relative; a quarter circle π/2 to 1e-12
- additive: length(a, b) + length(b, c) = length(a, c) to rounding
- The same result on every machine.
Use instead
nurbsCurve.sample: a polyline is wanted, not a number
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
q.length() // → 1.5707963267948… (π/2)