Struct linestring::cgmath_2d::LineString2 [−][src]
pub struct LineString2<T> where
T: BaseFloat + Sync, { pub connected: bool, // some fields omitted }
Expand description
A 2d line string, aka polyline. If the ‘connected’ field is set the ‘as_lines()’ method will connect start point with the end-point. Todo: The builder structure of this struct needs to be revisited
Fields
connected: bool
if connected is set the as_lines() method will add an extra line connecting the first and last point
Implementations
Copies the points of the iterator into the LineString2 from_iter is already claimed for into() objects.
Moves all the elements of other
into Self
, leaving other
empty.
TODO: currently ignores if other
is connected or not.
Panics
Panics if the number of elements in the points vector overflows a usize
.
Returns true if the lines are self intersecting If number of points < 10 then the intersections are tested using brute force O(n²) If more than that a sweep-line algorithm is used O(nlog(n)+ilog(n))
returns the number of points in the point list not the number of segments (add one if connected)
Returns the line string as a Vec of lines Will be deprecated at some time, use self.as_lines_iter().collect() instead
Returns the line string as a iterator of lines
The iterator of as_lines_iter() does not implement ExactSizeIterator. This can be used as a work around for that problem
Copy this linestring2 into a linestring3, populating the axes defined by ‘plane’ An axis will always try to keep it’s position (e.g. y goes to y if possible). That way the operation is reversible (with regards to axis positions).
Simplify using Ramer–Douglas–Peucker algorithm
Simplify using Visvalingam–Whyatt algorithm. This algorithm will delete ‘points_to_delete’ of points from the polyline with the smallest area defined by one point and it’s neighbours.
Trait Implementations
impl<T, IC> FromIterator<IC> for LineString2<T> where
T: BaseFloat + Sync,
IC: Into<Point2<T>>,
impl<T, IC> FromIterator<IC> for LineString2<T> where
T: BaseFloat + Sync,
IC: Into<Point2<T>>,
Creates a value from an iterator. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<T> RefUnwindSafe for LineString2<T> where
T: RefUnwindSafe,
impl<T> Send for LineString2<T> where
T: Send,
impl<T> Sync for LineString2<T>
impl<T> Unpin for LineString2<T> where
T: Unpin,
impl<T> UnwindSafe for LineString2<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.