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>) -> Chain2
pub const fn new(start: Frame2, pieces: Vec<ChainPiece2>) -> Chain2
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<f64>
pub fn length(&self) -> Option<f64>
Total arc length: the sum of the piece lengths, None when one is
not finite and positive.
Sourcepub fn joins(&self) -> Option<Vec<f64>>
pub fn joins(&self) -> Option<Vec<f64>>
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: f64) -> Option<(usize, &ChainPiece2, f64)>
pub fn piece_at(&self, s: f64) -> Option<(usize, &ChainPiece2, f64)>
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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Chain2
impl<'de> Deserialize<'de> for Chain2
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Chain2, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Chain2, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Chain2
impl Serialize for Chain2
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Chain2
Auto Trait Implementations§
impl Freeze for Chain2
impl RefUnwindSafe for Chain2
impl Send for Chain2
impl Sync for Chain2
impl Unpin for Chain2
impl UnsafeUnpin for Chain2
impl UnwindSafe for Chain2
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more