Function polygon_utils::triangulate(const polygon_msgs::msg::ComplexPolygon2D&)

Function Documentation

std::vector<polygon_msgs::msg::Point2D> polygon_utils::triangulate(const polygon_msgs::msg::ComplexPolygon2D &polygon)

Decompose a complex polygon into a set of triangles.

See https://en.wikipedia.org/wiki/Polygon_triangulation

Implementation from https://github.com/mapbox/earcut.hpp

Parameters:

polygon – The complex polygon to deconstruct

Returns:

A vector of points where each set of three points represents a triangle