Skip to content
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

Consistency of the radius argument for Path.points_in_path #2915

Merged
merged 3 commits into from
Apr 3, 2014

Conversation

simongibbons
Copy link
Contributor

Currently the documentation for the Path.points_in_path method implies that you can call it with a negative radius to shrink the path when making the comparison.

The code doesn't behave in that way, so here is a pull request which should fix it. If it does break something then the documentation should be updated.

Updated the points_in_path method to allow negative radii as is implied by the documentation.
@mdboom
Copy link
Member

mdboom commented Mar 21, 2014

👍

@tacaswell tacaswell added this to the v1.4.0 milestone Mar 21, 2014
@pelson
Copy link
Member

pelson commented Mar 27, 2014

Looks good. Any chance of a test case to cover this, otherwise it is likely to get broken again.

@simongibbons
Copy link
Contributor Author

There's the test case.

The Travis CI build seems to have failed though, the test I added now passes so I can't quite see what I've done wrong?


points = [(0.0, 0.0), (1.25, 0.0)]

assert np.all(path.contains_points(points, radius = -0.5) == [True, False] )
Copy link
Member

Choose a reason for hiding this comment

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

Could you also add a point which would be inside of the unit circle, but not inside of the unit circle with a radius of 0.5 (e.g. (0.9, 0.9)). I may have missed what radius actually does, so if my comment doesn't make any sense, please feel free to enlighten me 😉

Copy link
Member

Choose a reason for hiding this comment

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

P.S. It's incredibly picky I know, but would you mind removing the spaces between the keyword i.e.:

np.all(path.contains(points, radius=-0.5)...

@pelson
Copy link
Member

pelson commented Mar 27, 2014

The Travis CI build seems to have failed though

I think an update to the pep8 tool on pypi has triggered master's tests to fail - this is being dealt with, so don't worry about those.

This is looking good IMHO 👍

tacaswell added a commit that referenced this pull request Apr 3, 2014
Consistency of the radius argument for Path.points_in_path
@tacaswell tacaswell merged commit 655f3c0 into matplotlib:master Apr 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants