Type Definition fenris_geometry::LineSegment2d

source ·
pub type LineSegment2d<T> = LineSegment<T, U2>;

Implementations§

source§

impl<T> LineSegment2d<T>where
    T: Real,

source

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.

source

pub fn intersect_line_parametric(&self, line: &Line2d<T>) -> Option<T>

source

pub fn intersect_disk_parametric(&self, disk: &Disk<T>) -> Option<[T; 2]>

source

pub fn intersect_disk(&self, disk: &Disk<T>) -> Option<Self>

source

pub fn segment_from_parameters(&self, t_begin: &T, t_end: &T) -> Self

source

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.

source

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.

source

pub fn intersect_half_plane(&self, half_plane: &HalfPlane<T>) -> Option<Self>

source

pub fn intersect_polygon(
    &self,
    other: &ConvexPolygon<T>
) -> Option<LineSegment2d<T>>