ianmackenzie / elm-geometry / ArcLength

You will likely never need to use this module directly. In the vast majority of cases the individual curve modules such as QuadraticSpline2d should contain all the functionality you need to construct an arc length parameterization and use it to do things like evaluate a curve at evenly-spaced points. This module is primarily for use internally by those curve modules, but may be useful if you want to do some fancy mapping between arc length and curve parameter values.


type Parameterization units

Contains a mapping from curve parameter value to arc length, and vice versa. Parameter values are assumed to range from 0 to 1.

Constructing

parameterization : { derivativeMagnitude : Basics.Float -> Quantity Basics.Float units, maxSecondDerivativeMagnitude : Quantity Basics.Float units, maxError : Quantity Basics.Float units } -> Parameterization units

Build an arc length parameterization for some curve. You must supply:

Evaluating

total : Parameterization units -> Quantity Basics.Float units

Find the total arc length of some curve given its arc length parameterization;

ArcLength.total parameterization

is equivalent to

ArcLength.fromParameterValue 1 parameterization

but is more efficient. The arc length will be accurate to within the maximum error specified when building the parameterization.

toParameterValue : Quantity Basics.Float units -> Parameterization units -> Basics.Float

Convert an arc length to the corresponding parameter value. The given arc length will be clamped to the range [0, length].

fromParameterValue : Basics.Float -> Parameterization units -> Quantity Basics.Float units

Convert a parameter value to the corresponding arc length. The parameter value will be clamped to the range [0, 1].