pub struct Segment<T: Scalar, V: Vector<T>> {
pub s: V,
pub e: V,
/* private fields */
}Expand description
A line segment with defined start and end points.
Fields§
§s: VStart point.
e: VEnd point.
Implementations§
Source§impl<T: Scalar, V: Vector<T>> Segment<T, V>
impl<T: Scalar, V: Vector<T>> Segment<T, V>
Sourcepub fn closest_point_on_segment(&self, p: &V, epsilon: T) -> Option<(T, V)>
pub fn closest_point_on_segment(&self, p: &V, epsilon: T) -> Option<(T, V)>
Finds the closest point on the segment to a given point.
Returns:
t: Parameter value [0,1] where 0=start, 1=end- Point: The closest point on the segment
Returns None if the segment is too small.
Source§impl<T: FloatScalar, V: FloatVector<T>> Segment<T, V>
impl<T: FloatScalar, V: FloatVector<T>> Segment<T, V>
Trait Implementations§
impl<T: Copy + Scalar, V: Copy + Vector<T>> Copy for Segment<T, V>
Auto Trait Implementations§
impl<T, V> Freeze for Segment<T, V>where
V: Freeze,
impl<T, V> RefUnwindSafe for Segment<T, V>where
V: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, V> Send for Segment<T, V>
impl<T, V> Sync for Segment<T, V>
impl<T, V> Unpin for Segment<T, V>
impl<T, V> UnwindSafe for Segment<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