Expand description
Concrete space curves.
Each analytic curve is a thin parameterization over the shape descriptions
in ogeom-math; the spline curve carries its own control points. All of them
are reachable through Curve, an enum rather than a boxed trait object.
§Why an enum
Curves are stored in their millions in a real model, compared constantly,
and eventually serialized. An enum makes each of those cheap: no allocation,
no vtable, Clone and PartialEq derived, and (most usefully) exhaustive
matching, so adding a curve type produces a compile error at every site that
needs to know rather than a silent fallthrough.
Deliberately not #[non_exhaustive]. Marking it so would force every
match outside this crate to carry a wildcard arm, which is exactly the
silent fallthrough the enum exists to prevent: a new curve type would then
compile everywhere and be mishandled everywhere. The cost is that adding a
variant is a breaking change, which for a kernel this size is the right
trade: a curve type nobody handles is worse than a version bump.
CurveKind is non-exhaustive, because matching on it is for opting into
an analytic shortcut and a caller that does not recognise a kind should fall
back to the general path rather than fail to compile.
The Curve3d trait is still the interface algorithms are written against;
Curve implements it and forwards.
Structs§
- BSpline
Curve - A B-spline curve, polynomial or rational.
- Circle
Curve - A circle, parameterized by angle.
- Curve
OnSurface - A pcurve composed with the surface it is drawn on: the space curve a trimming boundary actually traces.
- Ellipse
Curve - An ellipse, parameterized by eccentric angle.
- Helix
Curve - A helix about its frame’s
z, parameterized by turn angle. - Hyperbola
Curve - One branch of a hyperbola.
- Line
Curve - A straight line, parameterized by length from its origin.
- Offset
Curve - A space curve displaced a constant signed distance perpendicular to a
reference direction: the offset direction at
tis the unit vector oftangent x reference, the classical spelling. - Parabola
Curve - A parabola.
- Trimmed
Curve - Another curve restricted to a sub-interval of its domain.
Enums§
- Curve
- A curve in space.
Constants§
- LINE_
EXTENT - How far along a line the default domain reaches either side of its origin.