pub struct PlineVertex<T = f64> {
    pub x: T,
    pub y: T,
    pub bulge: T,
}
Expand description

A polyline vertex is represented by an x, y, and bulge value.

x and y describe the 2D position of the vertex. bulge describes the arc sweep angle for the polyline segment that starts with this vertex. bulge is defined as tan(arc_sweep_angle / 4). Note a polyline arc segment can never have a sweep angle greater than PI (half circle).

See angle_from_bulge and bulge_from_angle for functions to convert between bulge arc sweep angle.

Fields§

§x: T

X coordinate position for the vertex.

§y: T

Y coordinate position for the vertex.

§bulge: T

Bulge for the polyline segment that starts with this vertex.

Implementations§

source§

impl<T> PlineVertex<T>
where T: Real,

source

pub fn new(x: T, y: T, bulge: T) -> Self

source

pub fn from_slice(slice: &[T]) -> Option<Self>

Construct a vertex from a [x, y, bulge] slice.

If the slice does not contain exactly 3 elements then None is returned.

source

pub fn from_vector2(vector2: Vector2<T>, bulge: T) -> Self

Construct a vertex using a 2D vector as the position.

source

pub fn with_bulge(&self, bulge: T) -> Self

Create a copy of the vertex with new bulge value but same x and y values.

source

pub fn pos(&self) -> Vector2<T>

Return the position as a 2D vector.

source

pub fn bulge_is_zero(&self) -> bool

Returns true if self.bulge.fuzzy_eq_zero() (represents the start of a line segment).

source

pub fn bulge_is_pos(&self) -> bool

Returns true if self.bulge > T::zero() (represents the start of a counter clockwise arc segment).

source

pub fn bulge_is_neg(&self) -> bool

Returns true if self.bulge < T::zero() (represents the start of a clockwise arc segment).

source

pub fn fuzzy_eq_eps(&self, other: Self, fuzzy_epsilon: T) -> bool

Fuzzy equal comparison with another vertex using fuzzy_epsilon given.

source

pub fn fuzzy_eq(&self, other: Self) -> bool

Fuzzy equal comparison with another vertex using T::fuzzy_epsilon().

Trait Implementations§

source§

impl<T: Clone> Clone for PlineVertex<T>

source§

fn clone(&self) -> PlineVertex<T>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for PlineVertex<T>

source§

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

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

impl<T: Default> Default for PlineVertex<T>

source§

fn default() -> PlineVertex<T>

Returns the “default value” for a type. Read more
source§

impl<T> Display for PlineVertex<T>
where T: Display,

source§

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

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

impl<T: PartialEq> PartialEq for PlineVertex<T>

source§

fn eq(&self, other: &PlineVertex<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Copy> Copy for PlineVertex<T>

source§

impl<T: Eq> Eq for PlineVertex<T>

source§

impl<T> StructuralPartialEq for PlineVertex<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for PlineVertex<T>
where T: RefUnwindSafe,

§

impl<T> Send for PlineVertex<T>
where T: Send,

§

impl<T> Sync for PlineVertex<T>
where T: Sync,

§

impl<T> Unpin for PlineVertex<T>
where T: Unpin,

§

impl<T> UnwindSafe for PlineVertex<T>
where T: UnwindSafe,

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> 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,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.