Expand description
Arc length along any evaluable curve and its inverse, and arc-length
chains (#239), re-exported on the same footing as curve and surface.
Arc length along any evaluable curve, and its inverse.
Most curves have no closed-form arc length: a cubic parabola
y = A x^3 needs int sqrt(1 + 9 A^2 x^4) dx, an elliptic integral, and
a B-spline or an ellipse is no better. Yet some data names a position by
distance along such a curve: an arc-length trim selector, or a chain
piece read by arc length. This module discharges both with quadrature of
the speed |c'(t)| and a safeguarded Newton root find, the same bargain
crate::arc_length makes for intrinsic curves: the stored value stays
exact, only reading it needs numerical work.
§Accuracy contract
arc_length2andarc_length3integrate the speed by adaptive 8-point Gauss-Legendre, panels split at every knot and polyline vertex (the speed is only piecewise smooth there) and bisected until a panel and its two halves agree to the panel’s share ofARC_LENGTH_TOLERANCE * max(1, length). That agreement is an error ESTIMATE, as QUADPACK’s is, not a proof; on a smooth speed the halves are far more accurate than the estimate says.parameter_at_arc_length2andparameter_at_arc_length3return a parameter whose arc length fromfrommatches the request to the same tolerance, or a parameter bracket collapsed to rounding.- Lines, intrinsic curves and chains are exact: their parameter is a multiple of arc length, so no quadrature is run.
A request past the end of a bounded curve, a start parameter outside its
domain, a curve whose speed does not evaluate, and a quadrature that
needs more than MAX_PANELS panels are refused by name.
Constants§
- ARC_
LENGTH_ TOLERANCE - Relative tolerance of every arc length and arc-length inverse this module
returns: the absolute tolerance for a length
lisARC_LENGTH_TOLERANCE * max(1, |l|), in the curve’s length unit. - MAX_
PANELS - Most quadrature panels one arc length may use before it refuses.
Functions§
- arc_
length2 - Signed arc length of a 2D curve from parameter
fromtoto: negative whento < from. See the module documentation for the tolerance. - arc_
length3 - Signed arc length of a 3D curve from parameter
fromtoto; seearc_length2. - parameter_
at_ arc_ length2 - The parameter at signed arc length
lengthfrom parameterfromalong a 2D curve: in increasing parameter for a positive length, decreasing for a negative one. - parameter_
at_ arc_ length3 parameter_at_arc_length2for a 3D curve.