Struct line_2d::LineSegment
source · pub struct LineSegment { /* private fields */ }
Expand description
A straight line between two different points
Implementations§
source§impl LineSegment
impl LineSegment
pub fn try_new(start: Coord, end: Coord) -> Result<Self, StartAndEndAreTheSame>
sourcepub fn new(start: Coord, end: Coord) -> Self
pub fn new(start: Coord, end: Coord) -> Self
Creates a new LineSegment
panicking if start
and end
are the same
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
pub fn infinite_iter(&self) -> InfiniteIter ⓘ
pub fn infinite_cardinal_iter(&self) -> InfiniteCardinalIter ⓘ
pub fn config_infinite_iter(&self, config: InfiniteConfig) -> InfiniteIter ⓘ
pub fn config_infinite_cardinal_iter( &self, config: InfiniteConfig ) -> InfiniteCardinalIter ⓘ
sourcepub fn iter(&self) -> Iter ⓘ
pub fn iter(&self) -> Iter ⓘ
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) -> CardinalIter ⓘ
pub fn cardinal_iter(&self) -> CardinalIter ⓘ
Iterator over all coordinates allowing only cardinal steps which begins on the start coordinate and ends with the end coordinate (inclusively)
pub fn config_iter(&self, config: Config) -> Iter ⓘ
pub fn config_cardinal_iter(&self, config: Config) -> CardinalIter ⓘ
pub fn infinite_node_iter(&self) -> InfiniteNodeIter ⓘ
pub fn infinite_cardinal_node_iter(&self) -> InfiniteCardinalNodeIter ⓘ
pub fn config_infinite_node_iter( &self, config: InfiniteConfig ) -> InfiniteNodeIter ⓘ
pub fn config_infinite_cardinal_node_iter( &self, config: InfiniteConfig ) -> InfiniteCardinalNodeIter ⓘ
pub fn node_iter(&self) -> NodeIter ⓘ
pub fn cardinal_node_iter(&self) -> CardinalNodeIter ⓘ
pub fn config_node_iter(&self, config: Config) -> NodeIter ⓘ
pub fn config_cardinal_node_iter(&self, config: Config) -> CardinalNodeIter ⓘ
Trait Implementations§
source§impl Clone for LineSegment
impl Clone for LineSegment
source§fn clone(&self) -> LineSegment
fn clone(&self) -> LineSegment
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for LineSegment
impl Debug for LineSegment
source§impl Hash for LineSegment
impl Hash for LineSegment
source§impl Ord for LineSegment
impl Ord for LineSegment
source§fn cmp(&self, other: &LineSegment) -> Ordering
fn cmp(&self, other: &LineSegment) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<LineSegment> for LineSegment
impl PartialEq<LineSegment> for LineSegment
source§fn eq(&self, other: &LineSegment) -> bool
fn eq(&self, other: &LineSegment) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<LineSegment> for LineSegment
impl PartialOrd<LineSegment> for LineSegment
source§fn partial_cmp(&self, other: &LineSegment) -> Option<Ordering>
fn partial_cmp(&self, other: &LineSegment) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more