pub struct Line2D { /* private fields */ }Expand description
A 2D line defined by origin and direction.
Parameterized as P(t) = origin + t * direction.
Implementations§
Source§impl Line2D
impl Line2D
Sourcepub fn project(&self, point: Point2) -> f64
pub fn project(&self, point: Point2) -> f64
Projects a point onto the line, returning the closest parameter.
Sourcepub fn distance_to_point(&self, point: Point2) -> f64
pub fn distance_to_point(&self, point: Point2) -> f64
Returns the perpendicular distance from a point to the line.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Line2D
impl<'de> Deserialize<'de> for Line2D
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Line2D
impl RefUnwindSafe for Line2D
impl Send for Line2D
impl Sync for Line2D
impl Unpin for Line2D
impl UnsafeUnpin for Line2D
impl UnwindSafe for Line2D
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