1al_triangulate_polygon(3) al_triangulate_polygon(3)
2
3
4
6 al_triangulate_polygon - Allegro 5 API
7
9 #include <allegro5/allegro_primitives.h>
10
11 bool al_triangulate_polygon(
12 const float* vertices, size_t vertex_stride, const int* vertex_counts,
13 void (*emit_triangle)(int, int, int, void*), void* userdata)
14
16 Divides a simple polygon into triangles, with zero or more other simple
17 polygons subtracted from it - the holes. The holes cannot touch or in‐
18 tersect with the outline of the main polygon. Simple means the polygon
19 does not have to be convex but must not be self-overlapping.
20
21 Parameters:
22
23 · vertices - Interleaved array of (x, y) vertex coordinates for each of
24 the polygons, including holes.
25
26 · vertex_stride - distance (in bytes) between successive pairs of ver‐
27 tices in the array.
28
29 · vertex_counts - Number of vertices for each polygon. The number of
30 vertices in the main polygon is given by vertex_counts[0] and must be
31 at least three. Subsequent elements indicate the number of vertices
32 in each hole. The array must be terminated with an element with val‐
33 ue zero.
34
35 · emit_triangle - a function to be called for every set of three points
36 that form a triangle. The function is passed the indices of the
37 points in vertices and userdata.
38
39 · userdata - arbitrary data to be passed to emit_triangle.
40
42 5.1.0
43
45 al_draw_filled_polygon_with_holes(3)
46
47
48
49Allegro reference manual al_triangulate_polygon(3)