Struct rin::graphics::PolylineSlice[][src]

pub struct PolylineSlice<'a, T = f32> where
    T: 'static + RealField + Debug
{ /* fields omitted */ }

An open or closed collection of vertices that represents a polyline or polygon

Has methods to do calculations over such geometrical shapes

This type doesn’t own the points and is usually a view on a PolylineSlice

Implementations

impl<'a, T> PolylineSlice<'a, T> where
    T: RealField + NumCast
[src]

pub fn new(points: &[Point<T, U2>], closed: bool) -> PolylineSlice<'_, T>[src]

creates a new polyline from the vector of points that must be ordered for the polyline methods to work correctly

pub fn area(&self) -> T[src]

returns the area of the polygon, only works if the polyline represents a polygon

pub fn centroid(&self) -> Point<T, U2>[src]

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]

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]

returns true if the polyline is closed

pub fn len(&self) -> usize[src]

returns total number of points

pub fn to_owned(&self) -> Polyline<T>[src]

pub fn smoothed(&self, window_size: usize, window_shape: T) -> Polyline<T>[src]

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 iter(&self) -> Iter<'_, Point<T, U2>>[src]

pub fn first(&self) -> Option<&Point<T, U2>>[src]

pub fn last(&self) -> Option<&Point<T, U2>>[src]

pub fn is_empty(&self) -> bool[src]

pub fn lerped_point_at(&self, fidx: T) -> Option<Point<T, U2>>[src]

Returns the point at an index + a normalized pct

pub fn segment_length(&self, idx: usize) -> Option<T>[src]

Returns the length of the segment at the passed index or None if such segment doesn’t exist

pub fn segment_length_squared(&self, idx: usize) -> Option<T>[src]

Returns the square length of the segment at the passed index or None if such segment doesn’t exist

pub fn wrap_index(&self, idx: isize) -> Option<usize>[src]

Returns an index wrapped around a closed polygon or clamped on a polyline. Will return None if the polyline is empty

pub fn next_non_zero_segment(&self, idx: usize) -> Option<usize>[src]

Finds the next segment which length is different than 0 starting from the passed index and wrapping around on closed polygons

pub fn prev_non_zero_segment(&self, idx: usize) -> Option<usize>[src]

Finds the previous segment which length is different than 0 starting from the passed index and wrapping around on closed polygons

impl<'a, T> PolylineSlice<'a, T> where
    T: NumCast + RealField
[src]

pub fn tangent_at(
    &self,
    idx: usize
) -> Option<Matrix<T, U2, U1, <DefaultAllocator as Allocator<T, U2, U1>>::Buffer>>
[src]

Tangent at the point in the passed index if it exists

pub fn lerped_tangent_at(
    &self,
    fidx: T
) -> Option<Matrix<T, U2, U1, <DefaultAllocator as Allocator<T, U2, U1>>::Buffer>>
[src]

Tangent at the lerped point at the passed index + normalized pct

Trait Implementations

impl<'a, T> AsRef<[Point<T, U2>]> for PolylineSlice<'a, T> where
    T: RealField
[src]

impl<'a, T> Clone for PolylineSlice<'a, T> where
    T: 'static + Clone + RealField + Debug
[src]

impl<'a, T> Debug for PolylineSlice<'a, T> where
    T: 'static + Debug + RealField
[src]

impl<'a, T> Index<usize> for PolylineSlice<'a, T> where
    T: RealField
[src]

type Output = Point<T, U2>

The returned type after indexing.

impl<'a, T> Into<&'a [Point<T, U2>]> for PolylineSlice<'a, T> where
    T: RealField
[src]

impl<'a, T> IntoIterator for PolylineSlice<'a, T> where
    T: RealField
[src]

type Item = &'a Point<T, U2>

The type of the elements being iterated over.

type IntoIter = Iter<'a, Point<T, U2>>

Which kind of iterator are we turning this into?

impl<'a, T> Copy for PolylineSlice<'a, T> where
    T: 'static + Copy + RealField + Debug
[src]

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for PolylineSlice<'a, T> where
    T: RefUnwindSafe

impl<'a, T> Send for PolylineSlice<'a, T>

impl<'a, T> Sync for PolylineSlice<'a, T>

impl<'a, T> Unpin for PolylineSlice<'a, T>

impl<'a, T> UnwindSafe for PolylineSlice<'a, T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Any + Send + Sync
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

impl<T> Slottable for T where
    T: Copy
[src]