alexbol99 / flatten-js

Javascript library for 2d geometry
MIT License
553 stars 58 forks source link

Is cutting a polygon with "holes" is supported ? #102

Closed dorli closed 1 year ago

dorli commented 2 years ago

Hey, I'm trying to cut a polygon that has a hole (different faces that have different orientations) but I'm getting an exception. I can't find an example of doing this in the tutorials or the tests, is that supposed to work?

alexbol99 commented 2 years ago

Hi, @dorli You are right, current implementation does not support polygon with holes. I will update it in a nearest future Do you need a method that cut polygon with a line or something more complicated? Best regards, Alex

alexbol99 commented 2 years ago

Hi @dorli , I added new method polygon.cutWithLine to release v1.3.2 but it still buggy. You can play with this method here: observablehq.com/@alexbol99/cut-polygon-with-line

dorli commented 2 years ago

Hi @alexbol99, First of all, thank you very much for the quick response and for this great library. I'm going to try the new method.

alexbol99 commented 2 years ago

Hi @dorli , I released new patch 1.3.3 with 2 bugs fixed for this method. Would be nice if you could test it. Alex