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>
impl<T> LineSegment2<T>
Sourcepub fn collinearity(&self, point: &Vector2<T>) -> T
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
endas viewed fromstart. - Positive means that the point is to the clockwise of
endas viewed fromstart.
Sourcepub fn intersects(&self, other: &LineSegment2<T>) -> bool
pub fn intersects(&self, other: &LineSegment2<T>) -> bool
True if this segment intersects the given segment based on collinearity.