pub struct LineSegment<T, D>{ /* private fields */ }
Implementations§
Source§impl<T: Real> LineSegment<T, Const<3>>
impl<T: Real> LineSegment<T, Const<3>>
pub fn closest_point_to_plane_parametric(&self, plane: &Plane<T>) -> T
pub fn closest_point_to_plane(&self, plane: &Plane<T>) -> Point3<T>
Source§impl<T, D> LineSegment<T, D>
impl<T, D> LineSegment<T, D>
Source§impl<T, D> LineSegment<T, D>
impl<T, D> LineSegment<T, D>
pub fn to_line(&self) -> Line<T, D>
Sourcepub fn tangent_dir(&self) -> OVector<T, D>
pub fn tangent_dir(&self) -> OVector<T, D>
Returns the vector tangent to the line, pointing from start to end.
Note that the vector is not normalized.
pub fn length(&self) -> T
pub fn midpoint(&self) -> OPoint<T, D>
Sourcepub fn closest_point_parametric(&self, point: &OPoint<T, D>) -> T
pub fn closest_point_parametric(&self, point: &OPoint<T, D>) -> T
Compute the closest point on the segment to the given point, represented in the parametric form x = a + t * (b - a).
Sourcepub fn closest_point(&self, point: &OPoint<T, D>) -> OPoint<T, D>
pub fn closest_point(&self, point: &OPoint<T, D>) -> OPoint<T, D>
Computes the closest point on the line to the given point.
pub fn point_from_parameter(&self, t: T) -> OPoint<T, D>
Source§impl<T> LineSegment<T, Const<2>>where
T: Real,
impl<T> LineSegment<T, Const<2>>where
T: Real,
Sourcepub fn normal_dir(&self) -> Vector2<T>
pub fn normal_dir(&self) -> Vector2<T>
Returns a vector normal to the line segment, in the direction consistent with a counter-clockwise winding order when the edge is part of a polygon.
In other words, the normal direction points “to the right” when following the segment from its first endpoint to its second.
Note that the vector is not normalized.
pub fn intersect_line_parametric(&self, line: &Line2d<T>) -> Option<T>
pub fn intersect_disk_parametric(&self, disk: &Disk<T>) -> Option<[T; 2]>
pub fn intersect_disk(&self, disk: &Disk<T>) -> Option<Self>
pub fn segment_from_parameters(&self, t_begin: &T, t_end: &T) -> Self
Sourcepub fn intersect_segment_parametric(
&self,
other: &LineSegment2d<T>,
) -> Option<T>
pub fn intersect_segment_parametric( &self, other: &LineSegment2d<T>, ) -> Option<T>
Computes the intersection of two line segments (if any), but returns the result as a parameter.
Let all points on this line segment be defined by the relation x = a + t * (b - a)
for 0 <= t <= 1. Then, if the two line segments intersect, t is returned. Otherwise,
None
is returned.
Sourcepub fn intersect_half_plane_parametric(
&self,
half_plane: &HalfPlane<T>,
) -> Option<[T; 2]>
pub fn intersect_half_plane_parametric( &self, half_plane: &HalfPlane<T>, ) -> Option<[T; 2]>
Compute the intersection between the line segment and a half-plane.
Returns None
if the segment and the half-plane do not intersect, otherwise
returns Some([t1, t2])
with t1 <= t2
, and t1
and t2
correspond to the start and end parameters
relative to the current line segment.
pub fn intersect_half_plane(&self, half_plane: &HalfPlane<T>) -> Option<Self>
pub fn intersect_polygon( &self, other: &ConvexPolygon<T>, ) -> Option<LineSegment2d<T>>
Source§impl<T: Real> LineSegment<T, Const<3>>
impl<T: Real> LineSegment<T, Const<3>>
pub fn intersect_plane_parametric(&self, plane: &Plane<T>) -> Option<T>
Trait Implementations§
Source§impl<T, D> Clone for LineSegment<T, D>
impl<T, D> Clone for LineSegment<T, D>
Source§fn clone(&self) -> LineSegment<T, D>
fn clone(&self) -> LineSegment<T, D>
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T, D> Debug for LineSegment<T, D>
impl<T, D> Debug for LineSegment<T, D>
Source§impl<T> From<LineSegment<T, Const<2>>> for ConvexPolygon<T>where
T: Scalar,
impl<T> From<LineSegment<T, Const<2>>> for ConvexPolygon<T>where
T: Scalar,
Source§fn from(segment: LineSegment2d<T>) -> Self
fn from(segment: LineSegment2d<T>) -> Self
Source§impl<T, D> PartialEq for LineSegment<T, D>
impl<T, D> PartialEq for LineSegment<T, D>
impl<T, D> Eq for LineSegment<T, D>
impl<T, D> StructuralPartialEq for LineSegment<T, D>
Auto Trait Implementations§
impl<T, D> !Freeze for LineSegment<T, D>
impl<T, D> !RefUnwindSafe for LineSegment<T, D>
impl<T, D> !Send for LineSegment<T, D>
impl<T, D> !Sync for LineSegment<T, D>
impl<T, D> !Unpin for LineSegment<T, D>
impl<T, D> !UnwindSafe for LineSegment<T, D>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.