Skip to main content

CantForm

Enum CantForm 

Source
#[non_exhaustive]
pub enum CantForm { Polynomial { coefficients: Vec<Scalar>, }, Cosine { start: Scalar, change: Scalar, }, Sine { start: Scalar, change: Scalar, }, VienneseBend { start: Scalar, change: Scalar, }, AboutRail { rail: RailSide, elevation: Scalar, }, }
Expand description

The shape of one cant piece over its own xi = s / length in [0, 1].

Height forms give the cant D (the left rail head above the right) in length units; the angle form gives the bank angle psi in radians.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Polynomial

D(xi) = coefficients[0] + coefficients[1] xi + coefficients[2] xi^2 + ...

Covers a constant cant (degree 0), a linear transition (degree 1), the Bloss transition D1 + dD (3 - 2 xi) xi^2 (degree 3) and each half of a Helmert transition (degree 2; see CantPiece::helmert). An empty list is zero.

Fields

§coefficients: Vec<Scalar>

Coefficients in ascending powers of xi.

§

Cosine

D(xi) = start + change (1 - cos(pi xi)) / 2: the half-cosine transition, tangent to its neighbours’ slopes at both ends.

Fields

§start: Scalar

Cant at xi = 0.

§change: Scalar

Cant gained over the piece.

§

Sine

D(xi) = start + change (xi - sin(2 pi xi) / (2 pi)): the sine transition, whose slope AND curvature vanish at both ends.

Fields

§start: Scalar

Cant at xi = 0.

§change: Scalar

Cant gained over the piece.

§

VienneseBend

psi(xi) = start + change xi^4 (35 - 84 xi + 70 xi^2 - 20 xi^3): the Viennese bend, written for the bank angle itself. Its first three derivatives vanish at both ends. The cant follows as b sin(psi).

Fields

§start: Scalar

Bank angle at xi = 0, radians.

§change: Scalar

Bank angle gained over the piece, radians.

§

AboutRail

A pivot piece rotating about the held rail (#279): e = elevation + s (b / 2) sin(psi) = elevation + s D / 2, D and psi the cant law’s at the same plan distance, s = +1 about the right rail and -1 about the left. See the module docs.

Derived, not a law of xi: CantLaw::value_at has no value for it and Banked3::pivot_at reads it. Refused in a cant law.

Fields

§rail: RailSide

The rail head that keeps its height.

§elevation: Scalar

Height e0 of the held rail head above the profile.

Trait Implementations§

Source§

impl Clone for CantForm

Source§

fn clone(&self) -> CantForm

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CantForm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CantForm

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for CantForm

Source§

fn eq(&self, other: &CantForm) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for CantForm

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CantForm

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.