[][src]Struct rin::math::Polyline

pub struct Polyline<T: Real = f32> { /* fields omitted */ }

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

Has methods to do calculations over such geometrical shapes

Methods

impl<T: Real + NumCast> Polyline<T>
[src]

creates an empty polyline

creates a new polyline from the vector of points but orders them CCW first

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

centroid of the polyline, should work for any collection of points although it will only make sense if it's a polygon

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

returns true if the polyline is closed

returns total number of points

add a new point at the end of the polyline

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).

Returns the point at an index + a normalized pct

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

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

Removes all points from the polyline

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

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

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

impl<T: Real + NumCast + Float> Polyline<T>
[src]

Tangent at the point in the passed index if it exists

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

Trait Implementations

impl<T> Into<Vec<Point<T, U2>>> for Polyline<T> where
    T: Real
[src]

impl<T: Real> AsRef<[Point<T, U2>]> for Polyline<T>
[src]

impl<T: Clone + Real> Clone for Polyline<T>
[src]

Performs copy-assignment from source. Read more

impl<T: Real> IntoIterator for Polyline<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

impl<T: Debug + Real> Debug for Polyline<T>
[src]

impl<T: Real> Index<usize> for Polyline<T>
[src]

The returned type after indexing.

impl<T: Real> IndexMut<usize> for Polyline<T>
[src]

impl<T> FromIterator<Point<T, U2>> for Polyline<T> where
    T: Real
[src]

impl<T: Real> Serialize for Polyline<T> where
    T: Serialize
[src]

impl<'de, T: Real> Deserialize<'de> for Polyline<T> where
    T: Deserialize<'de>, 
[src]

Auto Trait Implementations

impl<T> Send for Polyline<T> where
    T: Scalar

impl<T> Sync for Polyline<T> where
    T: Scalar

Blanket Implementations

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

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

impl<T> From for T
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> SetParameter for T
[src]

Sets value as a parameter of self.

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<V> IntoVec for V
[src]

impl<V> IntoPnt for V
[src]

impl<T> Same for T
[src]

Should always be Self

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