NDEVR
API Documentation
ConcavePolygon< t_type, t_vertex >

Stores convenience functions for a concavec polygon Works on a Polygon object to decompose it into triangles or sub-polygons. More...

Public Member Functions

 ConcavePolygon ()
 Default constructor.
 ConcavePolygon (const VertexArray &_vertices)
 Constructs a ConcavePolygon from a vertex array, ensuring right-handed winding.
bool checkIfRightHanded ()
 Checks whether this polygon's vertices are in right-handed (counter-clockwise) winding order.
void convexDecomp ()
 Decomposes this concave polygon into convex sub-polygons.
t_vertex getPoint (uint04 index) const
 Retrieves a vertex by index.
int getPointCount () const
 Returns the number of vertices in the polygon.
const VertexArray & getVertices () const
 Returns a const reference to the polygon's vertex array.
void returnLowestLevelPolys (Buffer< Polygon< t_type, t_vertex > > &returnArr)
 Appends all decomposed convex sub-polygons to the given buffer.

Detailed Description

template<class t_type, class t_vertex = Vertex<2, t_type>>
class ConcavePolygon< t_type, t_vertex >

Stores convenience functions for a concavec polygon Works on a Polygon object to decompose it into triangles or sub-polygons.


Definition at line 41 of file ConcaveToConvexPolygon.h.

Constructor & Destructor Documentation

◆ ConcavePolygon()

template<class t_type, class t_vertex = Vertex<2, t_type>>
ConcavePolygon< t_type, t_vertex >::ConcavePolygon ( const VertexArray & _vertices)
inline

Constructs a ConcavePolygon from a vertex array, ensuring right-handed winding.

Parameters
[in]_verticesThe vertices defining the concave polygon boundary.

Definition at line 438 of file ConcaveToConvexPolygon.h.

References checkIfRightHanded().

Member Function Documentation

◆ checkIfRightHanded()

template<class t_type, class t_vertex = Vertex<2, t_type>>
bool ConcavePolygon< t_type, t_vertex >::checkIfRightHanded ( )
inline

Checks whether this polygon's vertices are in right-handed (counter-clockwise) winding order.

Returns
True if the vertices have right-handed winding, false otherwise.

Definition at line 455 of file ConcaveToConvexPolygon.h.

References checkIfRightHanded().

Referenced by ConcavePolygon(), checkIfRightHanded(), and convexDecomp().

◆ convexDecomp()

template<class t_type, class t_vertex = Vertex<2, t_type>>
void ConcavePolygon< t_type, t_vertex >::convexDecomp ( )
inline

Decomposes this concave polygon into convex sub-polygons.

Iteratively splits the polygon at reflex vertices until all resulting sub-polygons are convex. Results are stored internally and can be retrieved via returnLowestLevelPolys().

Definition at line 467 of file ConcaveToConvexPolygon.h.

References Buffer< t_type, t_memory_manager >::add(), Bounds< t_dims, t_type, t_vertex >::addToBounds(), cast(), checkIfRightHanded(), getMax(), getMin(), IsInvalid(), IsValid(), Polygon< t_type, t_vertex >::vertex(), and Polygon< t_type, t_vertex >::vertexCount().

◆ getPoint()

template<class t_type, class t_vertex = Vertex<2, t_type>>
t_vertex ConcavePolygon< t_type, t_vertex >::getPoint ( uint04 index) const
inline

Retrieves a vertex by index.

Parameters
[in]indexThe index of the vertex to retrieve.
Returns
The vertex at the given index.

Definition at line 563 of file ConcaveToConvexPolygon.h.

◆ getPointCount()

template<class t_type, class t_vertex = Vertex<2, t_type>>
int ConcavePolygon< t_type, t_vertex >::getPointCount ( ) const
inline

Returns the number of vertices in the polygon.

Returns
The vertex count.

Definition at line 575 of file ConcaveToConvexPolygon.h.

◆ getVertices()

template<class t_type, class t_vertex = Vertex<2, t_type>>
const VertexArray & ConcavePolygon< t_type, t_vertex >::getVertices ( ) const
inline

Returns a const reference to the polygon's vertex array.

Returns
The vertices of this polygon.

Definition at line 543 of file ConcaveToConvexPolygon.h.

◆ returnLowestLevelPolys()

template<class t_type, class t_vertex = Vertex<2, t_type>>
void ConcavePolygon< t_type, t_vertex >::returnLowestLevelPolys ( Buffer< Polygon< t_type, t_vertex > > & returnArr)
inline

Appends all decomposed convex sub-polygons to the given buffer.

Parameters
[in]returnArrThe buffer to append the resulting convex polygons to.

Definition at line 553 of file ConcaveToConvexPolygon.h.


The documentation for this class was generated from the following file: