pub struct CantLaw {
pub pieces: Vec<CantPiece>,
}Expand description
A scalar law over plan distance: pieces laid end to end from zero.
Piece i spans [sum of earlier lengths, + length_i); a seam belongs to
the piece that starts there, and the last piece is closed at its far end.
A distance before zero or past the last piece has no value: the law is
not extrapolated, because an extrapolated transition is not a cant
anyone authored.
Fields§
§pieces: Vec<CantPiece>Pieces in order of plan distance.
Implementations§
Source§impl CantLaw
impl CantLaw
Sourcepub fn zero(length: f64) -> CantLaw
pub fn zero(length: f64) -> CantLaw
Zero over length: the pivot law of a rotation about the
centreline.
Sourcepub fn is_well_formed(&self) -> bool
pub fn is_well_formed(&self) -> bool
Whether every piece has a positive finite length and finite coefficients, and there is at least one piece.
Sourcepub fn has_angle_pieces(&self) -> bool
pub fn has_angle_pieces(&self) -> bool
Whether any piece gives a bank angle rather than a height.
Sourcepub fn has_rail_pieces(&self) -> bool
pub fn has_rail_pieces(&self) -> bool
Whether any piece rotates about a held rail
(CantForm::AboutRail), a pivot derived from the cant law.
Sourcepub fn value_at(&self, distance: f64) -> Option<CantValue>
pub fn value_at(&self, distance: f64) -> Option<CantValue>
Value at plan distance distance.
None when the law is malformed, distance is outside it, or the
piece there is a held-rail pivot (CantForm::AboutRail), whose
value comes from the cant law (Banked3::pivot_at).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CantLaw
impl<'de> Deserialize<'de> for CantLaw
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CantLaw, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CantLaw, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for CantLaw
impl Serialize for CantLaw
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 CantLaw
Auto Trait Implementations§
impl Freeze for CantLaw
impl RefUnwindSafe for CantLaw
impl Send for CantLaw
impl Sync for CantLaw
impl Unpin for CantLaw
impl UnsafeUnpin for CantLaw
impl UnwindSafe for CantLaw
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