pub struct LineSegment2D {
pub start: Point2D,
pub end: Point2D,
}Expand description
A directed 2D line segment from start to end.
Fields§
§start: Point2DStart point.
end: Point2DEnd point.
Implementations§
Source§impl LineSegment2D
impl LineSegment2D
Sourcepub fn point_on_segment(&self, t: f64) -> Point2D
pub fn point_on_segment(&self, t: f64) -> Point2D
Returns the point at parameter t along the segment.
t = 0.0 returns start, t = 1.0 returns end.
Sourcepub fn intersects(&self, other: &LineSegment2D) -> Option<Point2D>
pub fn intersects(&self, other: &LineSegment2D) -> Option<Point2D>
Computes the intersection point of two line segments, if it exists.
Uses parametric form. Returns None for parallel/coincident segments.
Trait Implementations§
Source§impl Clone for LineSegment2D
impl Clone for LineSegment2D
Source§fn clone(&self) -> LineSegment2D
fn clone(&self) -> LineSegment2D
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for LineSegment2D
Source§impl Debug for LineSegment2D
impl Debug for LineSegment2D
Source§impl PartialEq for LineSegment2D
impl PartialEq for LineSegment2D
impl StructuralPartialEq for LineSegment2D
Auto Trait Implementations§
impl Freeze for LineSegment2D
impl RefUnwindSafe for LineSegment2D
impl Send for LineSegment2D
impl Sync for LineSegment2D
impl Unpin for LineSegment2D
impl UnsafeUnpin for LineSegment2D
impl UnwindSafe for LineSegment2D
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