Struct geo::algorithm::sweep::LineOrPoint
source · pub struct LineOrPoint<T: GeoNum> { /* private fields */ }
Expand description
Either a line segment or a point.
The coordinates are ordered (see SweepPoint
) and a line
segment must have distinct points (use the Point
variant if the
coordinates are the equal).
Implementations§
source§impl<T: GeoNum> LineOrPoint<T>
impl<T: GeoNum> LineOrPoint<T>
pub fn left(&self) -> SweepPoint<T>
pub fn right(&self) -> SweepPoint<T>
pub fn end_points(&self) -> (SweepPoint<T>, SweepPoint<T>)
pub fn new(left: SweepPoint<T>, right: SweepPoint<T>) -> Self
source§impl<T: GeoFloat> LineOrPoint<T>
impl<T: GeoFloat> LineOrPoint<T>
sourcepub fn intersect_line(&self, other: &Self) -> Option<Self>
pub fn intersect_line(&self, other: &Self) -> Option<Self>
Intersect a line with self and return a point, a overlapping segment or None
.
The other
argument must be a line variant (debug builds will panic otherwise).
pub fn intersect_line_ordered(&self, other: &Self) -> Option<Self>
Trait Implementations§
source§impl<T: Clone + GeoNum> Clone for LineOrPoint<T>
impl<T: Clone + GeoNum> Clone for LineOrPoint<T>
source§fn clone(&self) -> LineOrPoint<T>
fn clone(&self) -> LineOrPoint<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: GeoFloat> Cross for LineOrPoint<T>
impl<T: GeoFloat> Cross for LineOrPoint<T>
source§impl<T: GeoNum> Debug for LineOrPoint<T>
impl<T: GeoNum> Debug for LineOrPoint<T>
source§impl<T: GeoNum> From<(SweepPoint<T>, SweepPoint<T>)> for LineOrPoint<T>
impl<T: GeoNum> From<(SweepPoint<T>, SweepPoint<T>)> for LineOrPoint<T>
source§fn from(pt: (SweepPoint<T>, SweepPoint<T>)) -> Self
fn from(pt: (SweepPoint<T>, SweepPoint<T>)) -> Self
Converts to this type from the input type.
source§impl<T: GeoNum> From<Line<T>> for LineOrPoint<T>
impl<T: GeoNum> From<Line<T>> for LineOrPoint<T>
Convert from a Line
ensuring end point ordering.
source§impl<T: GeoNum> From<SweepPoint<T>> for LineOrPoint<T>
impl<T: GeoNum> From<SweepPoint<T>> for LineOrPoint<T>
source§fn from(pt: SweepPoint<T>) -> Self
fn from(pt: SweepPoint<T>) -> Self
Converts to this type from the input type.
source§impl<T: GeoNum> PartialEq<LineOrPoint<T>> for LineOrPoint<T>
impl<T: GeoNum> PartialEq<LineOrPoint<T>> for LineOrPoint<T>
Equality based on ordering defined for segments as per algorithm.
source§impl<T: GeoNum> PartialOrd<LineOrPoint<T>> for LineOrPoint<T>
impl<T: GeoNum> PartialOrd<LineOrPoint<T>> for LineOrPoint<T>
Ordering defined for segments as per algorithm.
Requires the following conditions:
-
If comparing two lines, both the left ends must be strictly smaller than both right ends.
-
A point is treated as a infinitesimal small vertical segment centered at its coordinates.
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<T: Copy + GeoNum> Copy for LineOrPoint<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for LineOrPoint<T>where T: RefUnwindSafe,
impl<T> Send for LineOrPoint<T>where T: Send,
impl<T> Sync for LineOrPoint<T>where T: Sync,
impl<T> Unpin for LineOrPoint<T>where T: Unpin,
impl<T> UnwindSafe for LineOrPoint<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more