Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_polyfill_2d.h')
-rw-r--r--source/blender/blenlib/BLI_polyfill_2d.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_polyfill_2d.h b/source/blender/blenlib/BLI_polyfill_2d.h
index ca63ea5af87..25a624ba005 100644
--- a/source/blender/blenlib/BLI_polyfill_2d.h
+++ b/source/blender/blenlib/BLI_polyfill_2d.h
@@ -26,16 +26,32 @@ extern "C" {
struct MemArena;
+/**
+ * A version of #BLI_polyfill_calc that uses a memory arena to avoid re-allocations.
+ */
void BLI_polyfill_calc_arena(const float (*coords)[2],
- const unsigned int coords_tot,
- const int coords_sign,
+ unsigned int coords_tot,
+ int coords_sign,
unsigned int (*r_tris)[3],
struct MemArena *arena);
+/**
+ * Triangulates the given (convex or concave) simple polygon to a list of triangle vertices.
+ *
+ * \param coords: 2D coordinates describing vertices of the polygon,
+ * in either clockwise or counterclockwise order.
+ * \param coords_tot: Total points in the array.
+ * \param coords_sign: Pass this when we know the sign in advance to avoid extra calculations.
+ *
+ * \param r_tris: This array is filled in with triangle indices in clockwise order.
+ * The length of the array must be `coords_tot - 2`.
+ * Indices are guaranteed to be assigned to unique triangles, with valid indices,
+ * even in the case of degenerate input (self intersecting polygons, zero area ears... etc).
+ */
void BLI_polyfill_calc(const float (*coords)[2],
- const unsigned int coords_tot,
- const int coords_sign,
+ unsigned int coords_tot,
+ int coords_sign,
unsigned int (*r_tris)[3]);
/* default size of polyfill arena */