LoneArtisan wrote:What are some ways that "love.math.triangulate" can be put to use? I know it returns a polygon but what to do with it afterwards? I'd really like to hear your thought on this. Until then it'll be a mystery feature to me.
It "
return a polygon" is not true...I mean not *entirely* true. It returns a set of triangles. You provide a complex polygon (which is supposed to have more than 3 egdes) to the function, and it returns a set of triangles composing the given polygon.
Traingulation can be used in lots of different contexts for lots of reasons, but the main idea is dealing with polygon shapes can end up being too much complex. So instead, because the triangle shape is much more simple to deal with, it can be useful to triangulate a given polygon and then proceed with the set of triangles that we get as a result of the triangulation process.
A simple case I can mention is something I am actually working on... implement a
navigation mesh. Basically, it would take as an input a set of non overlapping n-sided polygons, and then, compute a route from any location to another provided that those locations are points inside any of the given set of polygons. The problem is, when the route is calculated accross those polygon, the final path has to be interpolated using string-pulling algorithms such as the
Funnel algorithm, which is quite complex to implement using random polygons. But if I can convert those polygons to triangles, then it becomes way more easier to implement
Hope this help.
Addendum: It seems
Löve 0.9.0 implements Kong's triangulation. Which seems simple and fast enough. Maybe i'll try to bench it against
Delauney's someday.