Enum line_2d::LineSegmentOrPoint
source · pub enum LineSegmentOrPoint {
LineSegment(LineSegment),
Point(Coord),
}
Expand description
The LineSegment
type can’t represent line segments of 0 length. It’s often convenient for
users to treat 0-length line segments as points. This type represent line segments which can be
of 0 length, treating such lines as single points.
Variants§
LineSegment(LineSegment)
Point(Coord)
Implementations§
source§impl LineSegmentOrPoint
impl LineSegmentOrPoint
pub fn new(start: Coord, end: Coord) -> Self
pub fn start(&self) -> Coord
pub fn end(&self) -> Coord
pub fn delta(&self) -> Coord
pub fn num_steps(&self) -> u32
pub fn num_cardinal_steps(&self) -> u32
pub fn reverse(&self) -> Self
sourcepub fn iter(&self) -> LineSegmentOrPointIter
pub fn iter(&self) -> LineSegmentOrPointIter
Iterator over all coordinates allowing ordinal steps which begins on the start coordinate and ends with the end coordinate (inclusively)
sourcepub fn cardinal_iter(&self) -> LineSegmentOrPointCardinalIter
pub fn cardinal_iter(&self) -> LineSegmentOrPointCardinalIter
Iterator over all coordinates allowing only cardinal steps which begins on the start coordinate and ends with the end coordinate (inclusively)