[][src]Trait plexus::primitive::Polygonal

pub trait Polygonal: Topological {
    fn is_convex(&self) -> bool
    where
        Self::Vertex: AsPosition,
        Position<Self::Vertex>: EuclideanSpace + FiniteDimensional<N = U2>,
        Scalar<Position<Self::Vertex>>: FloatConst
, { ... }
fn angles(&self) -> SmallVec<[Scalar<Position<Self::Vertex>>; 8]>
    where
        Self::Vertex: AsPosition,
        Position<Self::Vertex>: EuclideanSpace + FiniteDimensional<N = U2>,
        Scalar<Position<Self::Vertex>>: FloatConst
, { ... } }

Provided methods

fn is_convex(&self) -> bool where
    Self::Vertex: AsPosition,
    Position<Self::Vertex>: EuclideanSpace + FiniteDimensional<N = U2>,
    Scalar<Position<Self::Vertex>>: FloatConst

Determines if a polygon is convex.

This function rejects degenerate polygons, such as polygons with collinear or converged vertices.

fn angles(&self) -> SmallVec<[Scalar<Position<Self::Vertex>>; 8]> where
    Self::Vertex: AsPosition,
    Position<Self::Vertex>: EuclideanSpace + FiniteDimensional<N = U2>,
    Scalar<Position<Self::Vertex>>: FloatConst

Gets the relative angles between adjacent line segments.

Computes the angle between line segments at each vertex in order. The angles are wrapped into the interval $(-\pi,\pi]$. The sign of each angle specifies the orientation of adjacent line segments. Given a square, exactly four angles of $\plusmn\frac{\pi}{2}$ will be returned, with the sign depending on the winding of the square.

Adjacent vertices with the same position are ignored, as there is no meaningful line segment between such vertices. Because of this, it is possible that the number of angles returned by this function disagrees with the arity of the polygon.

Loading content...

Implementors

impl<T> Polygonal for Polygon<T>[src]

impl<T> Polygonal for NGon<[T; 3]>[src]

impl<T> Polygonal for NGon<[T; 4]>[src]

impl<T> Polygonal for NGon<[T; 5]>[src]

impl<T> Polygonal for NGon<[T; 6]>[src]

impl<T> Polygonal for NGon<[T; 7]>[src]

impl<T> Polygonal for NGon<[T; 8]>[src]

impl<T> Polygonal for NGon<[T; 9]>[src]

impl<T> Polygonal for NGon<[T; 10]>[src]

impl<T> Polygonal for NGon<[T; 11]>[src]

impl<T> Polygonal for NGon<[T; 12]>[src]

Loading content...