Expand description
Scalar reference implementation of curve evaluation (ADR 0012).
§What this closes
axiolid-curve declares Curve2/Curve3 and a CurveEvaluator trait. Until
now nothing in the workspace implemented that trait, so every declared curve
family was inert data. axiolid-mesh-compile worked around this with its own
private circle flattener and refused ellipses and B-splines outright.
§Design
Evaluation is analytic per family, never a generic subdivision fallback:
Line–origin + t * direction, exact.Circle–origin + r*(cos t * x + sin t * y),tin radians.Ellipse– same with independent semi-axes. Notetis the parametric angle, not the polar angle; they differ except on axis.Polyline–tin[0, n), integer part selects the segment. Chosen over arc-length parameterization because it is exact and stable under degenerate (zero-length) segments, which imported data contains.BSpline– de Boor. Rational curves evaluate in homogeneous space and project, which is the only way to get correct rational derivatives.
Derivatives are closed-form. A finite-difference derivative would make the
curvature oracle in tests/curve.rs self-referential: it would be checking
a difference quotient against a difference quotient.
§Frames are used as given
Imported frames may be non-orthonormal. Evaluation applies the frame axes as
written rather than orthonormalizing, so a caller sees the geometry its
source actually declared. Validation is a separate concern (axiolid-heal).
Structs§
- Curve
Jet - Position and the first two parameter derivatives of a curve.
- Scalar
Curve - Portable scalar curve evaluator.
Functions§
- bspline_
jet2 - Second-order differential jet of a 2D curve.
- bspline_
jet3 - Second-order differential jet of a 3D curve.
- derivative2
- First derivative of a 2D curve.
- derivative3
- First derivative of a 3D curve.
- domain2
- Domain of a 2D curve.
- domain3
- Domain of a 3D curve.
- evaluate2
- Position on a 2D curve.
- evaluate3
- Position on a 3D curve.
- flatten2
- Flatten a 2D curve over
domainso the chord never deviates from the true curve by more thanchord_tolerance. - flatten3
- Flatten a 3D curve to a polyline within
chord_tolerance. - invert2
- Parameter naming
pointon a 2D curve, or a refusal. - invert3
- Parameter naming
pointon a 3D curve, or a refusal. - jet2
- Second-order differential jet of a 2D curve.
- jet3
- Second-order differential jet of a 3D curve.
- locate2
- Parameter of a point on a 2D curve, iterating where no closed form
exists. See
locate3. - locate3
- Parameter of a point on a 3D curve, iterating where no closed form
exists:
invert3first, and for a B-spline the nearest of 64 samples per span refined by Newton on|C(t) - p|^2. The answer must reproduce the point withintolerance, asinvert3’s must. - second_
derivative2 - Second derivative of a 2D curve with respect to its native parameter.
- second_
derivative3 - Second derivative of a 3D curve with respect to its native parameter.