What are some uses for "love.math.triangulate"?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
LoneArtisan
Prole
Posts: 12
Joined: Thu Apr 11, 2013 6:20 pm

What are some uses for "love.math.triangulate"?

Post by LoneArtisan »

Nil
Last edited by LoneArtisan on Mon May 26, 2014 8:32 pm, edited 1 time in total.
You know that moment when you finally do that thing you've been trying to accomplish for hours and you finally get it exactly right? No matter how small the task was, it's one of the greatest things that could happen when you're programming!
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: What are some uses for "love.math.triangulate"?

Post by Roland_Yonaba »

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. :)
User avatar
LoneArtisan
Prole
Posts: 12
Joined: Thu Apr 11, 2013 6:20 pm

Re: What are some uses for "love.math.triangulate"?

Post by LoneArtisan »

Nil
Last edited by LoneArtisan on Mon May 26, 2014 8:32 pm, edited 1 time in total.
You know that moment when you finally do that thing you've been trying to accomplish for hours and you finally get it exactly right? No matter how small the task was, it's one of the greatest things that could happen when you're programming!
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests