Skip to main content

PathPiece

Struct PathPiece 

Source
#[non_exhaustive]
pub struct PathPiece { pub curve: PathCurve, pub start: f64, pub end: f64, pub reversed: bool, pub placement: Option<DAffine3>, pub placement_exact: bool, pub open_end: bool, pub start_bound: Option<PathBound>, pub end_bound: Option<PathBound>, }
Expand description

One piece of a CurvePath: the span [start, end] of a curve in its station measure, traversed forwards or backwards, optionally carried by a rigid placement; 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: PathCurve

The 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; a measurable piece has end > start. Not read where the end is open (Self::open_end).

§reversed: bool

Whether the path 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).

§open_end: bool

Whether the span runs to the curve’s end, which the evaluator resolves with its own length (#298; see the module documentation); end is then not read.

§start_bound: Option<PathBound>

Where the span starts when that is given as a parameter or a point rather than a distance (#304; see the module documentation); start is then not read.

§end_bound: Option<PathBound>

Where the span ends when that is given as a parameter or a point (#304); end is then not read. An end is bounded or open, not both: an evaluator refuses a piece whose end is both.

Implementations§

Source§

impl PathPiece

Source

pub fn new(curve: PathCurve, start: f64, end: f64) -> PathPiece

The span [start, end] of curve, forwards and unplaced.

Nothing is checked here: an evaluator refuses a span that is empty, not finite or outside its curve when it reads the path.

Source

pub fn to_end(curve: PathCurve, start: f64) -> PathPiece

The span of curve from start to its end, forwards and unplaced, the end left to the evaluator (#298; see the module documentation).

Nothing is checked here: an evaluator refuses a start that is not finite, or not before the curve’s end, when it reads the path.

Source

pub fn from_start(curve: PathCurve, end: f64) -> PathPiece

The span of curve from its start to end: [0, end], the station measure starting at 0 on every curve.

Source

pub fn whole(curve: PathCurve) -> PathPiece

The whole of curve, from its start to its end, no length stated (#298): Self::to_end from 0. An unbounded line is its parameter domain, from its origin to origin + direction.

Source

pub fn between_parameters(curve: PathCurve, t0: f64, t1: f64) -> PathPiece

The span of curve from its native parameter t0 to t1, t0 < t1 (except on a closed conic, below), forwards and unplaced, no distance stated (#304; see the module documentation). A closed conic’s angle runs round: its span runs from t0 forwards to t1 within one turn, across its parameter seam where t1 comes before t0, as a trim of it in its sense does.

Nothing is checked here: an evaluator refuses parameters that are not finite, not increasing or outside the curve when it reads the path.

Source

pub fn bounded(curve: PathCurve, start: PathBound, end: PathBound) -> PathPiece

The span of curve from start to end, each a parameter or a point, forwards and unplaced, no distance stated (#304). Both lie in the curve’s direction; on a closed conic the span runs from the start forwards to the end within one turn.

Nothing is checked here: an evaluator refuses a point off the curve or named by several parameters, and an empty span, when it reads the path.

Source

pub fn with_start(self, bound: PathBound) -> PathPiece

The same piece starting at bound rather than at a stated distance (#304): start then holds -Scalar::INFINITY, which nothing reads.

Source

pub fn with_end(self, bound: PathBound) -> PathPiece

The same piece ending at bound rather than at a stated distance or at its curve’s end (#304): end then holds Scalar::INFINITY, which nothing reads, and the end is no longer open.

Source

pub fn reversed(self) -> PathPiece

The same span traversed the other way.

Source

pub fn placed(self, rigid: DAffine3, exact: bool) -> PathPiece

The same piece carried further by the rigid motion rigid, applied after any placement it already has; exact when that motion is.

Source

pub fn length(&self) -> f64

The span’s length in its curve’s station measure, end - start; infinite where the end is open or an end is bounded by a parameter or a point, which only an evaluator resolves.

Source

pub fn is_stated(&self) -> bool

Whether every length the piece spans is stated: its own ends (not open, #298, nor bounded by a parameter or a point, #304), and its offset’s base piece’s.

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.

Trait Implementations§

Source§

impl Clone for PathPiece

Source§

fn clone(&self) -> PathPiece

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 PathPiece

Source§

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

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

impl Extend<PathPiece> for CurvePath

Source§

fn extend<I>(&mut self, pieces: I)
where I: IntoIterator<Item = PathPiece>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<PathPiece> for CurvePath

Source§

fn from(piece: PathPiece) -> CurvePath

Converts to this type from the input type.
Source§

impl From<StationPiece<'_>> for PathPiece

Source§

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

The piece, its curve copied.

Source§

impl FromIterator<PathPiece> for CurvePath

Source§

fn from_iter<I>(pieces: I) -> CurvePath
where I: IntoIterator<Item = PathPiece>,

Creates a value from an iterator. Read more
Source§

impl PartialEq for PathPiece

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PathPiece

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
§

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.