axiolid_curve/lib.rs
1#![forbid(unsafe_code)]
2
3//! Exact, format-neutral curve representations and evaluation contracts.
4//!
5//! Composite, trimmed, offset, and surface-bound curves are graph relations in
6//! `axiolid-model`; keeping them there avoids a curve/surface dependency cycle.
7
8pub mod conic;
9pub mod elevation;
10pub mod evaluate;
11pub mod implicit;
12mod intrinsic;
13mod intrinsic3;
14pub mod linear;
15pub mod pair_section;
16pub mod quadric_section;
17pub mod sinusoid;
18pub mod spline;
19pub mod spline_surface;
20pub mod torus_section;
21
22pub use conic::{Circle2, Circle3, Ellipse2, Ellipse3};
23pub use elevation::{Elevated3, ElevationLaw};
24pub use evaluate::CurveEvaluator;
25pub use implicit::{
26 Axis, Basis, Carrier, Field2, ImplicitCell, ImplicitCurve2, ImplicitSection3, Jet2,
27 LiftedCurve2, PatchField2, SeriesField2, SurfaceJet,
28};
29pub use intrinsic::{CurvatureLaw, Harmonic, Intrinsic2};
30pub use intrinsic3::Intrinsic3;
31pub use linear::{Line, Line2, Line3, Polyline, Polyline2, Polyline3};
32pub use pair_section::{PairNode, PairSection3};
33pub use quadric_section::{Branch, QuadraticGraph2, RuledCarrier, RuledSection3, Trig2};
34pub use sinusoid::Sinusoid2;
35pub use spline::{BSplineCurve, BSplineCurve2, BSplineCurve3, KnotSpec};
36pub use spline_surface::BSplineSurface;
37pub use torus_section::{AngleGraph2, TorusCarrier, TorusSection3};
38
39/// The focused linear vocabulary, re-exported for consumers that want to name
40/// its origin explicitly. A line-only consumer should depend on
41/// `axiolid-linear` directly instead of paying for this aggregate.
42pub mod linear_vocabulary {
43 pub use axiolid_linear::*;
44}
45
46/// Atomic two-dimensional curve values.
47#[non_exhaustive]
48#[derive(Debug, Clone, PartialEq)]
49pub enum Curve2 {
50 /// Infinite line.
51 Line(Line2),
52 /// Circle.
53 Circle(Circle2),
54 /// Ellipse.
55 Ellipse(Ellipse2),
56 /// Piecewise linear curve.
57 Polyline(Polyline2),
58 /// Polynomial or rational B-spline.
59 BSpline(BSplineCurve2),
60 /// Curve given by its natural equation: curvature as a function of arc
61 /// length, anchored to a start frame. Carries clothoid and other
62 /// transition spirals exactly, which no parametric variant can.
63 Intrinsic(Intrinsic2),
64 /// The graph `v = mean + a cos(t) + b sin(t)`: the exact pcurve of a
65 /// plane's cut across a cylinder, read in the cylinder's (angle, height)
66 /// parameters. See [`Sinusoid2`] (ADR 0071).
67 Sinusoid(Sinusoid2),
68 /// One root of `a(t) v^2 + b(t) v + c(t) = 0` as a graph over `t`: the
69 /// exact pcurve of a quadric's cut across a cylinder or cone. See
70 /// [`QuadraticGraph2`] (ADR 0076).
71 QuadraticGraph(QuadraticGraph2),
72 /// A solution of `a(t) cos u + b(t) sin u = c(t)` as `u` over `t`: the
73 /// exact pcurve of a plane's or sphere's cut across a torus. See
74 /// [`AngleGraph2`] (ADR 0076).
75 AngleGraph(AngleGraph2),
76 /// A stretch of a field's zero set, the field being another analytic
77 /// surface's equation read in this surface's parameters: the exact
78 /// pcurve of any section between planes, quadrics and tori. See
79 /// [`ImplicitCurve2`] (ADR 0077).
80 Implicit(ImplicitCurve2),
81 /// A space curve read in an analytic surface's parameters, sharing the
82 /// curve's parameter: the pcurve of a B-spline's section on the analytic
83 /// face it meets. See [`LiftedCurve2`] (ADR 0077).
84 Lifted(LiftedCurve2),
85}
86
87/// Atomic three-dimensional curve values.
88#[non_exhaustive]
89#[derive(Debug, Clone, PartialEq)]
90pub enum Curve3 {
91 /// Infinite line.
92 Line(Line3),
93 /// Circle in a plane.
94 Circle(Circle3),
95 /// Ellipse in a plane.
96 Ellipse(Ellipse3),
97 /// Piecewise linear curve.
98 Polyline(Polyline3),
99 /// Polynomial or rational B-spline.
100 BSpline(BSplineCurve3),
101 /// Curve given by its natural equations: curvature AND torsion as
102 /// functions of arc length, anchored to a start frame. Carries helices
103 /// and general space spirals as exact values.
104 Intrinsic(Intrinsic3),
105 /// A planar curve paired with an elevation law: the exact composition an
106 /// alignment centreline is authored as. See [`Elevated3`].
107 Elevated(Elevated3),
108 /// A quadric's cut across a cylinder or cone: the carrier evaluated along
109 /// a [`QuadraticGraph2`]. See [`RuledSection3`] (ADR 0076).
110 RuledSection(RuledSection3),
111 /// A plane's or sphere's cut across a torus: the torus evaluated along
112 /// an [`AngleGraph2`]. See [`TorusSection3`] (ADR 0076).
113 TorusSection(TorusSection3),
114 /// An [`ImplicitCurve2`] on its analytic carrier: the section of a
115 /// torus by a cylinder, cone or torus, and any other analytic pair with
116 /// no closed form. See [`ImplicitSection3`] (ADR 0077).
117 ImplicitSection(ImplicitSection3),
118 /// Where two B-spline surfaces meet, carried by nodes on both and
119 /// defined between them by the surfaces themselves. See
120 /// [`PairSection3`] (ADR 0077).
121 PairSection(PairSection3),
122}