pub struct CantPiece {
pub length: f64,
pub form: CantForm,
}Expand description
One piece of a CantLaw: a form over a plan length.
Fields§
§length: f64Plan length the piece covers. Positive and finite when well formed.
form: CantFormThe law over the piece’s own xi = s / length.
Implementations§
Source§impl CantPiece
impl CantPiece
Sourcepub fn linear(length: f64, start: f64, end: f64) -> CantPiece
pub fn linear(length: f64, start: f64, end: f64) -> CantPiece
A linear transition from start to end.
Sourcepub fn bloss(length: f64, start: f64, end: f64) -> CantPiece
pub fn bloss(length: f64, start: f64, end: f64) -> CantPiece
A Bloss transition: start + (end - start) (3 - 2 xi) xi^2.
Sourcepub fn helmert(length: f64, start: f64, end: f64) -> [CantPiece; 2]
pub fn helmert(length: f64, start: f64, end: f64) -> [CantPiece; 2]
A Helmert (two-parabola) transition from start to end over
length, as its two halves.
Over the whole transition, with x = s / length, the cant is
start + 2 dD x^2 up to x = 1/2 and end - 2 dD (1 - x)^2 after.
Each half is written in its own xi:
start + dD/2 xi^2, then start + dD/2 + dD xi - dD/2 xi^2.
Sourcepub fn cosine(length: f64, start: f64, end: f64) -> CantPiece
pub fn cosine(length: f64, start: f64, end: f64) -> CantPiece
A half-cosine transition from start to end.
Sourcepub fn sine(length: f64, start: f64, end: f64) -> CantPiece
pub fn sine(length: f64, start: f64, end: f64) -> CantPiece
A sine transition from start to end.
Sourcepub fn viennese_bend(length: f64, start: f64, end: f64) -> CantPiece
pub fn viennese_bend(length: f64, start: f64, end: f64) -> CantPiece
A Viennese bend from bank angle start to end, radians.
Sourcepub const fn about_rail(
length: f64,
rail: RailSide,
elevation: f64,
) -> CantPiece
pub const fn about_rail( length: f64, rail: RailSide, elevation: f64, ) -> CantPiece
A pivot piece rotating about the held rail, whose head stands
elevation above the profile (CantForm::AboutRail).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CantPiece
impl<'de> Deserialize<'de> for CantPiece
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CantPiece, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CantPiece, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for CantPiece
impl Serialize for CantPiece
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 CantPiece
Auto Trait Implementations§
impl Freeze for CantPiece
impl RefUnwindSafe for CantPiece
impl Send for CantPiece
impl Sync for CantPiece
impl Unpin for CantPiece
impl UnsafeUnpin for CantPiece
impl UnwindSafe for CantPiece
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