Type Definition fenris_geometry::LineSegment2d
source · pub type LineSegment2d<T> = LineSegment<T, U2>;
Implementations§
source§impl<T> LineSegment2d<T>where
T: Real,
impl<T> LineSegment2d<T>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.