# [−][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.