pub struct Line<T: Scalar, V: Vector<T>> {
pub p: V,
pub d: V,
/* private fields */
}Expand description
An infinite line in 2D or 3D space.
Defined by a point on the line and a direction vector.
Fields§
§p: VPoint on the line.
d: VDirection of the line.
Implementations§
Source§impl<T: Scalar, V: Vector<T>> Line<T, V>
impl<T: Scalar, V: Vector<T>> Line<T, V>
Sourcepub fn new(p: &V, d: &V, epsilon: T) -> Option<Self>
pub fn new(p: &V, d: &V, epsilon: T) -> Option<Self>
Creates a new line from a point and direction.
Returns None if the direction is too small.
Sourcepub fn from_start_end(s: &V, e: &V, epsilon: T) -> Option<Self>
pub fn from_start_end(s: &V, e: &V, epsilon: T) -> Option<Self>
Creates a line from two points.
The line passes through both points, with direction from s to e.
Returns None if the points are too close.
Sourcepub fn closest_point_on_line(&self, p: &V, epsilon: T) -> Option<(T, V)>
pub fn closest_point_on_line(&self, p: &V, epsilon: T) -> Option<(T, V)>
Finds the closest point on the line to a given point.
Returns:
t: Parameter value where the closest point occurs- Point: The closest point on the line
Returns None if the line direction is too small.
Source§impl<T: FloatScalar, V: FloatVector<T>> Line<T, V>
impl<T: FloatScalar, V: FloatVector<T>> Line<T, V>
Trait Implementations§
impl<T: Copy + Scalar, V: Copy + Vector<T>> Copy for Line<T, V>
Auto Trait Implementations§
impl<T, V> Freeze for Line<T, V>where
V: Freeze,
impl<T, V> RefUnwindSafe for Line<T, V>where
V: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, V> Send for Line<T, V>
impl<T, V> Sync for Line<T, V>
impl<T, V> Unpin for Line<T, V>
impl<T, V> UnwindSafe for Line<T, V>where
V: UnwindSafe,
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