Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix zerolen intersect#16250

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jklymak merged 7 commits intomatplotlib:masterfromtacaswell:fix_zerolen_intersect
Jan 23, 2020

Conversation

tacaswell
Copy link
Member

PR Summary

This provides two fixes for#15842 which independently fix the reported bug.

The first merges segments when iterating through the paths, the second ensures that a 0 length segment intersects with no other segment (rather than all (or maybe just some?) segments.

The 0 length segment not intersecting any segments, including ones it is a point on, matches the behavior of shapely.

attn@TarasKuzyo

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant

@tacaswelltacaswell added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelJan 18, 2020
@tacaswelltacaswell added this to thev3.1.3 milestoneJan 18, 2020
@tacaswell
Copy link
MemberAuthor

Comparedf6316c and325d0ce , I am not sure which of those is the correct way to ID "zero length" segments. I am open to only one of these fixes going in, but this seems like a case where a belt-and-suspenders approach is warranted.

while (c2.vertex(&x22, &y22) != agg::path_cmd_stop) {
// if the segment in path 2 is 0 length, skip to next vertex
if ((x21 == x22) && (y21 == y22)) {
continue;
Copy link
Contributor

@anntzeranntzerJan 20, 2020
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

if you're really going to do the check to zero-len both here and in segments_intersect (which seems weird as well, I'd rather not(?)) at least the check should be the same in both places (len < epsilon)?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

My logic was this:

  • computing== is cheaper
  • if trip the== condition, we will trigger the determinant condition, but the converse is not true.
  • do the cheaper, stricter thing here
  • do the more expensive looser thing where we have to (see my discussion with@timhoffm above)
  • keep all of the "isclose" logic together in the code so we are sure that the numbers don't get out of sync

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Well you could change the signature of isclose() to just isclose(a, b) and force atol and rtol as constants in the body of the function... I'm not going to block over that though.

Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

if CI passes

One method tofixmatplotlib#15842In this case we check in `path_intersect_path` that as we iteratethrough the segments, if we hit a 0 length segment we grab the nextvertex before checking if the segments from the two paths intersect.
One method tofixmatplotlib#15842In this case we check that if either segment is 0 length, itintersects with no other segments, not all other segments.
To make clear we won't be changing them.
Use length square being close to 0 rather than strict.  I have a worrythat because we are using "close" for identifying the determinant is0, if we use strict equality for the length, then we may pass throughthe length check, but erroneously go through the den == 0 path.
Makes it a bit easier to identify failing cases.
 - move the "close to 0" computation from segments_intersect to path_intersects_path so we only do it once. - change the signature of the c function isclose to back the atol and rtol into the function (to make sure the two places we use it stay in sync)
@jklymakjklymak merged commit7e1a47c intomatplotlib:masterJan 23, 2020
@lumberbot-app
Copy link

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.1.x$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 7e1a47c252a5da06961dc2484602f57fa3009d77
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #16250: Fix zerolen intersect'
  1. Push to a named branch :
git push YOURFORK v3.1.x:auto-backport-of-pr-16250-on-v3.1.x
  1. Create a PR against branch v3.1.x, I would have named this PR:

"Backport PR#16250 on branch v3.1.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free tosuggest an improvement.

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJan 23, 2020
timhoffm added a commit that referenced this pull requestJan 23, 2020
…250-on-v3.2.xBackport PR#16250 on branch v3.2.x (Fix zerolen intersect)
@tacaswelltacaswell deleted the fix_zerolen_intersect branchJanuary 24, 2020 21:15
tacaswell pushed a commit to tacaswell/matplotlib that referenced this pull requestJan 25, 2020
Merge pull requestmatplotlib#16250 from tacaswell/fix_zerolen_intersectFix zerolen intersectAlso re-factors some tests.Conflicts:lib/matplotlib/tests/test_path.py          - unrelated change to test above new test.  Kept old version            of test and added new test
timhoffm added a commit that referenced this pull requestJan 26, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm left review comments

@anntzeranntzeranntzer approved these changes

@jklymakjklymakjklymak approved these changes

@QuLogicQuLogicAwaiting requested review from QuLogic

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v3.1.3
Development

Successfully merging this pull request may close these issues.

5 participants
@tacaswell@anntzer@jklymak@timhoffm@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp