#include <AdvancedMath.hpp>
Public Member Functions | |
template<typename ComponentType> | |
const std::vector< IndexType > & | Triangulate (const std::vector< Vector2< ComponentType > > &Polygon) |
Triangulates a simple polygon using the ear-clipping algorithm. | |
2D polygon triangulator.
The class implements the ear-clipping algorithm to triangulate simple (i.e. non-self-intersecting) 2D polygons.
|
inline |
Triangulates a simple polygon using the ear-clipping algorithm.
[in] | ComponentType - Vertex component type (e.g. float, double or int). |
[in] | Polygon | - A list of polygon vertices. The last vertex is assumed to be connected to the first one |
The winding order of each triangle is the same as the winding order of the polygon.
The function does not check if the polygon is simple, e.g. that it does not self-intersect.