Struct rinmath::Polyline [−][src]
pub struct Polyline<T: Real> { /* fields omitted */ }
Methods
impl<T: Real + NumCast> Polyline<T>
[src]
impl<T: Real + NumCast> Polyline<T>
pub fn new() -> Polyline<T>
[src]
pub fn new() -> Polyline<T>
creates an empty polyline
pub fn new_from_disordered_points(
points: Vec<Pnt2<T>>,
closed: bool
) -> Polyline<T>
[src]
pub fn new_from_disordered_points(
points: Vec<Pnt2<T>>,
closed: bool
) -> Polyline<T>
creates a new polyline from the vector of points but orders them CCW first
pub fn area(&self) -> T
[src]
pub fn area(&self) -> T
returns the area of the polygon, only works if the polyline represents a polygon
pub fn centroid(&self) -> Pnt2<T>
[src]
pub fn centroid(&self) -> Pnt2<T>
centroid of the polyline, should work for any collection of points although it will only make sense if it's a polygon
pub fn close(&mut self)
[src]
pub fn close(&mut self)
mark this polyline as being a closed shape, although not necesarily a polygon. Any rendering or calculation will take into account that the first and last points are joined
pub fn is_closed(&self) -> bool
[src]
pub fn is_closed(&self) -> bool
returns true if the polyline is closed
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
returns total number of points
pub fn push(&mut self, p: Pnt2<T>)
[src]
pub fn push(&mut self, p: Pnt2<T>)
add a new point at the end of the polyline
pub fn smoothed(&self, window_size: usize, window_shape: T) -> Polyline<T>
[src]
pub fn smoothed(&self, window_size: usize, window_shape: T) -> Polyline<T>
Returns a smoothed version of the polyline.
window_size
is the size of the smoothing window. So if
window_size
is 2, then 2 points from the left, 1 in the center,
and 2 on the right (5 total) will be used for smoothing each point.
window_shape
describes whether to use a triangular window (0) or
box window (1) or something in between (for example, .5).
pub fn subdivide_linear(&self, resolution: usize) -> Polyline<T>
[src]
pub fn subdivide_linear(&self, resolution: usize) -> Polyline<T>
ⓘImportant traits for Iter<'a, T>pub fn iter(&self) -> Iter<Pnt2<T>>
[src]
pub fn iter(&self) -> Iter<Pnt2<T>>
pub fn first(&self) -> Option<&Pnt2<T>>
[src]
pub fn first(&self) -> Option<&Pnt2<T>>
pub fn first_mut(&mut self) -> Option<&mut Pnt2<T>>
[src]
pub fn first_mut(&mut self) -> Option<&mut Pnt2<T>>
pub fn last(&self) -> Option<&Pnt2<T>>
[src]
pub fn last(&self) -> Option<&Pnt2<T>>
pub fn last_mut(&mut self) -> Option<&mut Pnt2<T>>
[src]
pub fn last_mut(&mut self) -> Option<&mut Pnt2<T>>
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Trait Implementations
impl<T: Clone + Real> Clone for Polyline<T>
[src]
impl<T: Clone + Real> Clone for Polyline<T>
fn clone(&self) -> Polyline<T>
[src]
fn clone(&self) -> Polyline<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Debug + Real> Debug for Polyline<T>
[src]
impl<T: Debug + Real> Debug for Polyline<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Real> AsRef<[Pnt2<T>]> for Polyline<T>
[src]
impl<T: Real> AsRef<[Pnt2<T>]> for Polyline<T>
impl<T: Real> Index<usize> for Polyline<T>
[src]
impl<T: Real> Index<usize> for Polyline<T>
type Output = Pnt2<T>
The returned type after indexing.
fn index(&self, idx: usize) -> &Pnt2<T>
[src]
fn index(&self, idx: usize) -> &Pnt2<T>
Performs the indexing (container[index]
) operation.
impl<T: Real> IndexMut<usize> for Polyline<T>
[src]
impl<T: Real> IndexMut<usize> for Polyline<T>
fn index_mut(&mut self, idx: usize) -> &mut Pnt2<T>
[src]
fn index_mut(&mut self, idx: usize) -> &mut Pnt2<T>
Performs the mutable indexing (container[index]
) operation.
impl<T> FromIterator<Pnt2<T>> for Polyline<T> where
T: Real,
[src]
impl<T> FromIterator<Pnt2<T>> for Polyline<T> where
T: Real,
fn from_iter<I>(iter: I) -> Polyline<T> where
I: IntoIterator<Item = Pnt2<T>>,
[src]
fn from_iter<I>(iter: I) -> Polyline<T> where
I: IntoIterator<Item = Pnt2<T>>,
Creates a value from an iterator. Read more
impl<T> Into<Vec<Pnt2<T>>> for Polyline<T> where
T: Real,
[src]
impl<T> Into<Vec<Pnt2<T>>> for Polyline<T> where
T: Real,