Skip to main content

Segment

Struct Segment 

Source
pub struct Segment<'a, T> {
    pub from: &'a Point<T>,
    pub to: &'a Point<T>,
}
Expand description

The straight line between two endpoints.

Fields§

§from: &'a Point<T>

The first point in the segment.

§to: &'a Point<T>

The last point in the segment.

Trait Implementations§

Source§

impl<'a, T: Debug> Debug for Segment<'a, T>

Source§

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

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

impl<'a, T> Edge<'a> for Segment<'a, T>
where T: Signed + Float,

Source§

type Vertex = Point<T>

The endpoint type of the edge.
Source§

fn new(from: &'a Self::Vertex, to: &'a Self::Vertex) -> Self

Returns an edge from the given endpoints.
Source§

fn midpoint(&self) -> Self::Vertex

Returns the middle point of this edge.
Source§

fn contains(&self, point: &Self::Vertex, tolerance: &Tolerance<T>) -> bool

Returns true if, and only if, the given point exists in this edge.
Source§

fn intersection( &self, rhs: &Self, tolerance: &Tolerance<T>, ) -> Option<Self::Vertex>

Returns the intersection between this edge and rhs, if any.

Auto Trait Implementations§

§

impl<'a, T> Freeze for Segment<'a, T>
where &'a Point<T>: Freeze,

§

impl<'a, T> RefUnwindSafe for Segment<'a, T>
where &'a Point<T>: RefUnwindSafe,

§

impl<'a, T> Send for Segment<'a, T>
where &'a Point<T>: Send,

§

impl<'a, T> Sync for Segment<'a, T>
where &'a Point<T>: Sync,

§

impl<'a, T> Unpin for Segment<'a, T>
where &'a Point<T>: Unpin,

§

impl<'a, T> UnsafeUnpin for Segment<'a, T>
where &'a Point<T>: UnsafeUnpin,

§

impl<'a, T> UnwindSafe for Segment<'a, T>
where &'a Point<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.