pub struct Chain2 {
pub start: Frame2,
pub pieces: Vec<ChainPiece2>,
}Expand description
A plane curve parameterised by cumulative arc length, its pieces placed rigidly end to end. See the module documentation.
Dirty imported data stays representable, as everywhere else in this
crate: Self::is_well_formed names what an evaluator refuses
structurally.
Fields§
§start: Frame2Start frame: origin at the chain start, x along the start tangent.
pieces: Vec<ChainPiece2>Pieces in order of travel.
Implementations§
Source§impl Chain2
impl Chain2
Sourcepub const fn new(start: Frame2, pieces: Vec<ChainPiece2>) -> Self
pub const fn new(start: Frame2, pieces: Vec<ChainPiece2>) -> Self
A chain of pieces starting at start.
Sourcepub fn is_well_formed(&self) -> bool
pub fn is_well_formed(&self) -> bool
Whether the chain is structurally sound: at least one piece, a finite start frame with independent axes, every length finite and positive, every curvature law well formed, every parametric start finite.
Whether a parametric piece’s curve has length of arc after start
needs a quadrature, so it is an evaluator’s check, not this one.
Sourcepub fn length(&self) -> Option<Scalar>
pub fn length(&self) -> Option<Scalar>
Total arc length: the sum of the piece lengths, None when one is
not finite and positive.
Sourcepub fn joins(&self) -> Option<Vec<Scalar>>
pub fn joins(&self) -> Option<Vec<Scalar>>
Arc length at each interior join, ascending: where piece i + 1
begins. Empty for one piece; None when a length is not finite and
positive.
Sourcepub fn piece_at(&self, s: Scalar) -> Option<(usize, &ChainPiece2, Scalar)>
pub fn piece_at(&self, s: Scalar) -> Option<(usize, &ChainPiece2, Scalar)>
The piece covering arc length s, its index, and s rebased to the
piece start.
Pieces are half-open, so a join belongs to the piece that starts
there; the last piece is closed at the chain end. None outside
[0, length], for a non-finite s and for a malformed length.