mfogel / polygon-clipping

Apply boolean polygon clipping operations (union, intersection, difference, xor) to your Polygons & MultiPolygons.
MIT License
543 stars 63 forks source link

Use robust-predicates for comparing segments #143

Closed rowanwins closed 1 year ago

rowanwins commented 1 year ago

This PR uses the robust-predicates library for comparing vector angles.

I've updated some tests - basically it adds an extra point in output geometries where there are overlapping segments.

I'm going to go through some of the issues in the repo and 🤞 it resolves some of the issues.

Resolves #89 Resolves #92

codecov[bot] commented 1 year ago

Codecov Report

Base: 98.25% // Head: 98.25% // No change to project coverage :thumbsup:

Coverage data is based on head (39f0a10) compared to base (b064f94). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #143 +/- ## ======================================= Coverage 98.25% 98.25% ======================================= Files 11 11 Lines 801 801 Branches 263 265 +2 ======================================= Hits 787 787 Misses 14 14 ``` | [Impacted Files](https://codecov.io/gh/mfogel/polygon-clipping/pull/143?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mike+Fogel) | Coverage Δ | | |---|---|---| | [src/vector.js](https://codecov.io/gh/mfogel/polygon-clipping/pull/143/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mike+Fogel#diff-c3JjL3ZlY3Rvci5qcw==) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mike+Fogel). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mike+Fogel)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

mfogel commented 1 year ago

Awesome, thanks @rowanwins!

I'll run this locally this weekend, and if all works fine for me as well, I'll merge in.

rowanwins commented 1 year ago

I've just trawled through a bunch of issues and it doesn't look like it makes any difference :sob: I tried removing some of the rounding operations to see if that combined with this PR makes any difference but it also didn't help.

mfogel commented 1 year ago

It appears this changes has no meaningful effect on performance, at least that's what npm run bench shows.

Merging in!