Hi all,
I need the method of polygon clipping. but I didn't find any lib for this. what I want is to do operation Boolean of two polygons. "and","or","not",
I try to translate https://github.com/tmpvar/2d-polygon-boolean into lua. but always get errors. Can you help me with this? or correct my code translated.
Thank you!
【solved】Help with Polygon Clipping
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
【solved】Help with Polygon Clipping
Last edited by Alexar on Wed Sep 14, 2016 6:16 am, edited 1 time in total.
Re: Help with Polygon Clipping
I know we spoke about this earlier, but I forgot to mention this ticket in the issue tracker:
https://bitbucket.org/rude/love/issues/ ... n-lovemath
I would use something like this, I'm sure you would too; maybe it could be added if enough people would use it.
About the code you posted, something is wrong with table.reverse, it creates a new reversed table but never returns it, and the code that calls table.reverse treats it like an in-place operation (doesn't use return value). Haven't looked at the rest closely yet.
https://bitbucket.org/rude/love/issues/ ... n-lovemath
I would use something like this, I'm sure you would too; maybe it could be added if enough people would use it.
About the code you posted, something is wrong with table.reverse, it creates a new reversed table but never returns it, and the code that calls table.reverse treats it like an in-place operation (doesn't use return value). Haven't looked at the rest closely yet.
Re: Help with Polygon Clipping
please help me with the rest, i am nearly mad on this method.airstruck wrote:About the code you posted, something is wrong with table.reverse, it creates a new reversed table but never returns it, and the code that calls table.reverse treats it like an in-place operation (doesn't use return value). Haven't looked at the rest closely yet.
Re: Help with Polygon Clipping
Are the polygons convex?
The intersection of two convex polygons is a convex polygon. The union, rarely. The "not" operation I don't understand, unless you mean subtraction.
There are efficient algorithms to intersect convex polygons. The article the code you've posted is based on deals with arbitrary polygons, even self-intersecting.
The intersection of two convex polygons is a convex polygon. The union, rarely. The "not" operation I don't understand, unless you mean subtraction.
There are efficient algorithms to intersect convex polygons. The article the code you've posted is based on deals with arbitrary polygons, even self-intersecting.
Re: Help with Polygon Clipping
I wish I could help but I really have no experience with this stuffAlexar wrote:please help me with the rest, i am nearly mad on this method.
I'd have to port the whole thing to Lua like you're doing, I can't really tell if anything's wrong by looking at it.
Re: 【solved】Help with Polygon Clipping
Awesome, can't wait to try it!
Who is online
Users browsing this forum: Google [Bot] and 79 guests