Skip to main content

StationPiece

Struct StationPiece 

Source
#[non_exhaustive]
pub struct StationPiece<'c> { pub curve: StationCurve<'c>, pub start: f64, pub end: f64, pub reversed: bool, pub placement: Option<DAffine3>, pub placement_exact: bool, }
Expand description

One piece of a CompositeBasis: the span [start, end] of an atomic curve, in that curve’s station measure, traversed forwards or backwards, optionally placed by a rigid motion; see the module documentation.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§curve: StationCurve<'c>

The atomic curve.

§start: f64

Where the span starts, in the curve’s station measure from its start (negative only on a line).

§end: f64

Where the span ends, greater than start.

§reversed: bool

Whether the composite runs from end to start.

§placement: Option<DAffine3>

The rigid motion carrying the curve, if it is placed.

§placement_exact: bool

Whether that placement is exact, rounding aside (true with no placement).

Implementations§

Source§

impl<'c> StationPiece<'c>

Source

pub fn whole(curve: StationCurve<'c>) -> Result<StationPiece<'c>, GeomError>

The whole curve: [0, L], L its station length; an unbounded line is its parameter domain [0, 1], from its origin to origin + direction.

§Errors

A curve whose length a station cannot be measured against, by name.

Source

pub fn between( curve: StationCurve<'c>, start: f64, end: f64, ) -> Result<StationPiece<'c>, GeomError>

The span [start, end] of curve, in its station measure.

§Errors

A non-finite or empty span, and one outside the curve’s measure (before its start or past its length, beyond the arc-length tolerance; a closed conic’s span may cross its parameter seam but not exceed one turn), by name.

Source

pub fn between_parameters( curve: StationCurve<'c>, t0: f64, t1: f64, ) -> Result<StationPiece<'c>, GeomError>

The span between native parameters t0 < t1 of curve, converted to its station measure. A closed conic’s span may start anywhere and cross its parameter seam (at most one turn).

§Errors

As Self::between, and the arc-length quadrature’s refusals.

Source

pub const fn reversed(self) -> StationPiece<'c>

The same span traversed the other way.

Source

pub fn placed(self, rigid: DAffine3, exact: bool) -> StationPiece<'c>

The same piece carried further by the rigid motion rigid (applied after any placement it already has), exact when that motion is (as PathPiece::placed).

Source

pub fn offset(offset: StationOffset<'c>) -> Result<StationPiece<'c>, GeomError>

The whole of an offset (#289): [0, L], L its own length.

§Errors

The offset’s refusals (a collapse, a cusp, a self-crossing), by name.

Source

pub fn from_path_piece( piece: &'c PathPiece, ) -> Result<StationPiece<'c>, GeomError>

The station piece of a path piece: its span checked against its curve as Self::between checks it, then reversed and placed as the path piece is. An open end (PathPiece::open_end, #298) is resolved first to where the curve ends by this evaluator’s own length, the end Self::whole reads (see the module documentation). A bound at a parameter or a point (PathPiece::start_bound, PathPiece::end_bound, #304) is resolved to the curve’s parameter there (StationCurve::parameter_at_bound) and that to its measure: a piece bounded at both ends is Self::between_parameters (see the module documentation).

§Errors

As Self::between and Self::between_parameters, an open end on a curve with no bounded length, an end both open and bounded, a bound’s refusals (StationCurve::parameter_at_bound), and a piece kind this evaluator does not know, by name.

Source

pub fn native_span(&self) -> Result<(f64, f64), GeomError>

The native parameters t0 < t1 the kernel reads at the piece’s start and end measures, the ones a point read inside the piece is evaluated at: m / |d| on a line, m / r on a circle (past 2 pi where the piece crosses its seam), m on a curve parameterised by its measure, and on a polyline, an ellipse or a B-spline the arc-length inverse from the curve’s start (a closed ellipse past its length: 2 pi plus the inverse of the measure less the length). A graph compiler that flattens the curve between them lands on the points CompositeBasis::section_on reads at the same distances.

§Errors

An offset piece (it takes its basis’s parameter, not its own length), an elevated or banked curve (it is measured in plan distance), and the quadratures’ refusals, by name.

Source

pub fn length(&self) -> f64

The piece’s length in its station measure.

Source

pub fn convention(&self) -> DistanceConvention

The distance convention the piece is measured in.

Source

pub fn frame_is_exact(&self) -> bool

Whether a frame read on this piece is exact, rounding aside: a line (an offset of a line by a constant law included), placed, if at all, exactly (as PathPiece::frame_is_exact).

Source

pub fn section_on( &self, u: f64, side: SeamSide, ) -> Result<SectionFrame, GeomError>

The section frame at distance u into the piece, read from side on a seam of its curve; at the piece’s own ends it is always read from inside the piece.

§Errors

The curve evaluators’ refusals, and a plan-measured curve placed by a motion that tilts +Z, by name.

Trait Implementations§

Source§

impl<'c> Clone for StationPiece<'c>

Source§

fn clone(&self) -> StationPiece<'c>

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<'c> Copy for StationPiece<'c>

Source§

impl<'c> Debug for StationPiece<'c>

Source§

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

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

impl From<StationPiece<'_>> for PathPiece

Source§

fn from(piece: StationPiece<'_>) -> PathPiece

The piece, its curve copied.

Source§

impl<'c> PartialEq for StationPiece<'c>

Source§

fn eq(&self, other: &StationPiece<'c>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<'c> StructuralPartialEq for StationPiece<'c>

Auto Trait Implementations§

§

impl<'c> Freeze for StationPiece<'c>

§

impl<'c> RefUnwindSafe for StationPiece<'c>

§

impl<'c> Send for StationPiece<'c>

§

impl<'c> Sync for StationPiece<'c>

§

impl<'c> Unpin for StationPiece<'c>

§

impl<'c> UnsafeUnpin for StationPiece<'c>

§

impl<'c> UnwindSafe for StationPiece<'c>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.