LineSegment2

Type Alias LineSegment2 

Source
pub type LineSegment2<T> = LineSegment<T, 2>;
Expand description

Line segment in two dimensions

Aliased Type§

pub struct LineSegment2<T> {
    pub start: Matrix<T, Const<2>, Const<1>, ArrayStorage<T, 2, 1>>,
    pub end: Matrix<T, Const<2>, Const<1>, ArrayStorage<T, 2, 1>>,
}

Fields§

§start: Matrix<T, Const<2>, Const<1>, ArrayStorage<T, 2, 1>>

One end of the line segment, the point returned when interpolating at t = 0.0

§end: Matrix<T, Const<2>, Const<1>, ArrayStorage<T, 2, 1>>

One end of the line segment, the point returned when interpolating at t = 1.0

Implementations§

Source§

impl<T> LineSegment2<T>
where T: Zero + One + Scalar + RealField,

Source

pub fn bounds(&self) -> Rect<T>
where T: Number,

AABB for a 2D line segment

Source

pub fn collinearity(&self, point: &Vector2<T>) -> T

Test whether a point is collinear with this segment.

  • 0.0 means collinear. Near to 0.0 means near to collinear.
  • Negative means that the point is to the counter-clockwise of end as viewed from start.
  • Positive means that the point is to the clockwise of end as viewed from start.
Source

pub fn intersects(&self, other: &LineSegment2<T>) -> bool

True if this segment intersects the given segment based on collinearity.