-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New plane split logic #27
Conversation
Looks good from limited local testing, waiting for Gecko try now: https://treeherder.mozilla.org/#/jobs?repo=try&selectedJob=225602367&revision=f546502f53b1bf032426ed54e79cbe87d83b6fe2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think in detail about the algorithm itself, but the general code changes seem fine. My only question is whether we need more tests for the various match conditions in split_impl
? Otherwise, r=me.
@gw3583 the tests for those cases where already in place, thankfully, so I don't expect any regressions. Thanks for taking a look! |
Here is a brief description of the change: Old algorithmFor each edge, intersect with the crossing line. if there are 2 edges with intersections, split the polygon. Problem here is that the intersection algorithm would produce discontinuous results around vertices, thus we were hitting issues whenever the intersection goes across a vertex closely. New algorithmGet the perpendicular vector to the cut, which happens to be the normal of the other intersection plane. Using this side vector, for each point figure out which side it's in, each side is represented by a floating point number. Where it crosses 0 is the edge for us to cut. So far, the process is continuous across the perimeter of the polygon. Once we figure out which edges to cut, we go into |
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 --HG-- extra : moz-landing-system : lando
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 --HG-- extra : moz-landing-system : lando
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 [wrupdater] From https://hg.mozilla.org/mozilla-central/rev/553538a675ecaf39eebcaf54d6dce1e5d159cca0
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 [wrupdater] From https://hg.mozilla.org/mozilla-central/rev/2cbf16256f4ef5c0e234229ba5fb8840cdf04f4d
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 [wrupdater] From https://hg.mozilla.org/mozilla-central/rev/553538a675ecaf39eebcaf54d6dce1e5d159cca0
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 [wrupdater] From https://hg.mozilla.org/mozilla-central/rev/553538a675ecaf39eebcaf54d6dce1e5d159cca0
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 UltraBlame original commit: 553538a675ecaf39eebcaf54d6dce1e5d159cca0
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 UltraBlame original commit: 2cbf16256f4ef5c0e234229ba5fb8840cdf04f4d
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 UltraBlame original commit: 553538a675ecaf39eebcaf54d6dce1e5d159cca0
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 UltraBlame original commit: 2cbf16256f4ef5c0e234229ba5fb8840cdf04f4d
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 UltraBlame original commit: 553538a675ecaf39eebcaf54d6dce1e5d159cca0
Update to have servo/plane-split#27 included Differential Revision: https://phabricator.services.mozilla.com/D18593 UltraBlame original commit: 2cbf16256f4ef5c0e234229ba5fb8840cdf04f4d
Fixes #26
This PR rewrites the logic of splitting a polygon by a line, deprecating the old function. The new one is robust against floating point inaccuracies, and handles the cases well when line intersection is very close to some of the vertices.