toanqng/martinez-rueda

orb.Polygon intersection example

Opened this issue · 0 comments

Heya, your lib looks great but I'm struggling to figure out how to use it...

I have two orb.Polygon geometries which I'd like to generate the intersection of.
Do you possibly have an example of how I can achieve this using your lib?

From the code it looks like I can convert each orb.Loop to a martinez_rueda.Contour and then construct a martinez_rueda.Polygon which I can use with martinez_rueda.Compute() to generate the intersection and then reverse the process to convert back to an orb.Polygon?

Are there any gotchas I should be aware of such as whether the orb.Point values in the martinez_rueda.Contour should be closed (ie the first point should/should not be repeated as the last point) and whether winding order is important?

Thanks!