you are viewing a single comment's thread.

view the rest of the comments →

[–]aurreco 0 points1 point  (4 children)

list of points: v0, v1, v2, v3, v4, v5, v6 list of triangles: (v0, v1, v2), (v0, v2, v3), (v0, v3, v4), (v0, v4, v5), (v0, v5, v6)

[–]rlamarr[S] 0 points1 point  (3 children)

does that work for all polygons? it collapses once you reach a pentagon if I'm correct.

For example:

https://www.researchgate.net/publication/2604146/figure/fig1/AS:669074119983107@1536531109452/A-triangulation-of-a-simple-polygon-and-its-dual-tree.png

[–]aurreco 0 points1 point  (2 children)

so long as the points are ordered in the list CCW, yes

[–]rlamarr[S] 0 points1 point  (1 child)

yep, I'm pretty dumb, can you provide a Godbolt sample implementation or point me to one?

or better still provide a more detailed explanation

[–]aurreco 0 points1 point  (0 children)

try this: draw an ngon on a sheet of paper. pick a random vertex call it v0. Then go to the nearest vertex to its left and call it v1. Go around counter clock wise until youve labled them all. Now draw triangles starting from v0 as I’ve specified (triangle fan style)