Earcut polygon triangulation

Ahmet Sait nightmarex1337 at hotmail.com
Sun Feb 23 16:20:09 UTC 2020


On Sunday, 23 February 2020 at 10:07:44 UTC, Ferhat Kurtulmuş 
wrote:
> For those who are interested in game programming, geospatial 
> things, 2D graphics etc. Earcut is a polygon triangulation 
> library originally written in js and ported to almost every 
> popular language (except D). I was playing around with my hobby 
> sdl game and needed to draw some concave polygons. So, I have 
> just ported the lib (suitable for betterC). My initial tests 
> showed that it is fast that can be used for real-time 
> rendering. If you have a function that can draw triangles, you 
> can draw concave/convex any polygon which can also have holes.
>
> https://github.com/mapbox/earcut.hpp
> https://github.com/aferust/earcut-d

Out of curiosity, why would you need to triangulate polygons 
instead of using stencil buffer? I'm assuming you're using OpenGL 
(or something similar) since you talked about your hobby game. 
Any advantage of triangulating shapes? (anti-aliasing maybe?)


More information about the Digitalmars-d-announce mailing list