pub struct Line<T = i64> {
pub start: Point2d<T>,
pub end: Point2d<T>,
}
Expand description
A line segment with a direction.
Fields§
§start: Point2d<T>
The start of the line segment.
end: Point2d<T>
The end of the line segment.
Implementations§
Source§impl Line
impl Line
Sourcepub fn get_intersection(self, other: Self) -> Option<Point2d>
pub fn get_intersection(self, other: Self) -> Option<Point2d>
Returns a point where two line segments intersect (if any).
Sourcepub fn with_manhattan_length(self, len: i64) -> Self
pub fn with_manhattan_length(self, len: i64) -> Self
Shorten the line to make its manhattan length the given one.
Sourcepub fn len_squared(&self) -> i64
pub fn len_squared(&self) -> i64
Compute the square of the length.
Trait Implementations§
Source§impl From<Line> for DebugContent
impl From<Line> for DebugContent
impl<T: Copy> Copy for Line<T>
impl<T> StructuralPartialEq for Line<T>
Auto Trait Implementations§
impl<T> Freeze for Line<T>where
T: Freeze,
impl<T> RefUnwindSafe for Line<T>where
T: RefUnwindSafe,
impl<T> Send for Line<T>where
T: Send,
impl<T> Sync for Line<T>where
T: Sync,
impl<T> Unpin for Line<T>where
T: Unpin,
impl<T> UnwindSafe for Line<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