I'm making a C++ project and need to triangulate shape from a given set of points defining the contour of said shape.
The contour is defined in a form of a vector containing x,y
coordinates of the points in 2D space. Points are placed in vector in an order that defines how they are connected to form the shape (points[idx]
is linked via contour line with points[idx - 1]
and points[idx + 1]
).
Now I need to generate triangles for that contour in order to create a flat mesh, what algorithm should I use for that problem?
Here is an example, I've got set of black points, can determine shape from order in vector (represented via green lines) and need to generate triangles (red lines). I want to achieve something like in the picture on the left (with proper reflex angles) and not something like picture on the right.