pub struct Segment<Point>(pub Point, pub Point);Expand description
A strait line segment between two points.
Tuple Fields§
§0: Point§1: PointImplementations§
Source§impl<P: CartesianPoint2d> Segment<P>
impl<P: CartesianPoint2d> Segment<P>
Sourcepub fn distance_to_point_sq<Point: CartesianPoint2d<Num = P::Num>>(
&self,
point: &Point,
) -> P::Num
pub fn distance_to_point_sq<Point: CartesianPoint2d<Num = P::Num>>( &self, point: &Point, ) -> P::Num
Shortest euclidean distance (squared) between a point and the segment:
- if the normal from the point to the segment ends inside the segment, the returned value is the squared length of the normal
- if the normal from the point to the segment ends outside of the segment, the returned value is the smaller one of the distances between the point and the segment’s endpoints
Sourcepub fn intersects<Point: CartesianPoint2d<Num = P::Num>>(
&self,
other: &Segment<Point>,
) -> bool
pub fn intersects<Point: CartesianPoint2d<Num = P::Num>>( &self, other: &Segment<Point>, ) -> bool
Returns true, if the segment has at least one common point with the other segment.
Trait Implementations§
Source§impl<Point: Ord> Ord for Segment<Point>
impl<Point: Ord> Ord for Segment<Point>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<Point: PartialOrd> PartialOrd for Segment<Point>
impl<Point: PartialOrd> PartialOrd for Segment<Point>
impl<Point: Eq> Eq for Segment<Point>
impl<Point> StructuralPartialEq for Segment<Point>
Auto Trait Implementations§
impl<Point> Freeze for Segment<Point>where
Point: Freeze,
impl<Point> RefUnwindSafe for Segment<Point>where
Point: RefUnwindSafe,
impl<Point> Send for Segment<Point>where
Point: Send,
impl<Point> Sync for Segment<Point>where
Point: Sync,
impl<Point> Unpin for Segment<Point>where
Point: Unpin,
impl<Point> UnwindSafe for Segment<Point>where
Point: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CoordinateMetadata for Twhere
T: ?Sized,
impl<T> CoordinateMetadata for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.