alexbol99 / flatten-js

Javascript library for 2d geometry
MIT License
546 stars 56 forks source link

Bad performance with boolean operations #127

Closed ya-ponchik closed 1 year ago

ya-ponchik commented 2 years ago

Hello. Thanks for your wonderful library. I'm making worms-like game using it:

https://user-images.githubusercontent.com/102679269/183088459-19cdf087-01aa-427f-98c0-98b2611e3306.mp4

I'm subtract a circle from giant polygon (autogenerated from vector image by approximating Bezier curves) and it's slow. I made a simple change https://github.com/ya-ponchik/flatten-js/commit/a1ba74c456fe1f10fa104c5bf64c95895ac63639 and it became almost unnoticeable.

I would be glad if you include something like this in the library (or tell me how to do my stuff better with existing features).

rikkertkoppes commented 2 years ago

You may want to start by not considering all edges of polygon1, but only the ones within the box of polygon2

ya-ponchik commented 1 year ago

I switched to another library