Struct fenris_geometry::LineSegment
source · pub struct LineSegment<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<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>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
impl<T, D> LineSegment<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
source§impl<T, D> LineSegment<T, D>where
T: Real,
D: DimName,
DefaultAllocator: Allocator<T, D>,
impl<T, D> LineSegment<T, D>where
T: Real,
D: DimName,
DefaultAllocator: Allocator<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>where
T: Scalar + Clone,
D: DimName + Clone,
DefaultAllocator: Allocator<T, D>,
impl<T, D> Clone for LineSegment<T, D>where
T: Scalar + Clone,
D: DimName + Clone,
DefaultAllocator: Allocator<T, D>,
source§fn clone(&self) -> LineSegment<T, D>
fn clone(&self) -> LineSegment<T, D>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<T, D> Debug for LineSegment<T, D>where
T: Scalar + Debug,
D: DimName + Debug,
DefaultAllocator: Allocator<T, D>,
impl<T, D> Debug for LineSegment<T, D>where
T: Scalar + Debug,
D: DimName + Debug,
DefaultAllocator: Allocator<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<LineSegment<T, D>> for LineSegment<T, D>where
T: Scalar + PartialEq,
D: DimName + PartialEq,
DefaultAllocator: Allocator<T, D>,
impl<T, D> PartialEq<LineSegment<T, D>> for LineSegment<T, D>where
T: Scalar + PartialEq,
D: DimName + PartialEq,
DefaultAllocator: Allocator<T, D>,
source§fn eq(&self, other: &LineSegment<T, D>) -> bool
fn eq(&self, other: &LineSegment<T, D>) -> bool
self
and other
values to be equal, and is used
by ==
.impl<T, D> Eq for LineSegment<T, D>where
T: Scalar + Eq,
D: DimName + Eq,
DefaultAllocator: Allocator<T, D>,
impl<T, D> StructuralEq for LineSegment<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
impl<T, D> StructuralPartialEq for LineSegment<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
Auto Trait Implementations§
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§
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.