pub struct LineSegment(pub Site, pub Site);Expand description
Representation of a line segment.
Tuple Fields§
§0: Site§1: SiteImplementations§
Source§impl LineSegment
impl LineSegment
Sourcepub fn get_intersection(&self, other: &Self) -> Option<Site>
pub fn get_intersection(&self, other: &Self) -> Option<Site>
Calculate the intersection of two line segments. If the intersection is outside the line segments or not exist, return None.
Sourcepub fn get_projection(&self, site: &Site) -> Option<Site>
pub fn get_projection(&self, site: &Site) -> Option<Site>
Calculate the perpendicular projection of the site on the line segment. If the projection is outside the line segment, return None.
Sourcepub fn get_distance(&self, site: &Site) -> f64
pub fn get_distance(&self, site: &Site) -> f64
Calculate the distance from the site to the line segment.
Trait Implementations§
Source§impl Clone for LineSegment
impl Clone for LineSegment
Source§fn clone(&self) -> LineSegment
fn clone(&self) -> LineSegment
Returns a duplicate 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 Debug for LineSegment
impl Debug for LineSegment
Source§impl PartialEq for LineSegment
impl PartialEq for LineSegment
Auto Trait Implementations§
impl Freeze for LineSegment
impl RefUnwindSafe for LineSegment
impl Send for LineSegment
impl Sync for LineSegment
impl Unpin for LineSegment
impl UnwindSafe for LineSegment
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