Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 655f3c0

Browse files
committed
Merge pull request #2915 from simongibbons/master
Consistency of the radius argument for Path.points_in_path
2 parents 32cf4ce + edfbd10 commit 655f3c0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/matplotlib/tests/test_path.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ def test_point_in_path():
2727

2828
assert np.all(path.contains_points(points) == [True, False])
2929

30+
def test_contains_points_negative_radius():
31+
path = Path.unit_circle()
32+
33+
points = [(0.0, 0.0), (1.25, 0.0), (0.9, 0.9)]
34+
expected = [True, False, False]
35+
36+
assert np.all(path.contains_points(points, radius=-0.5) == expected)
3037

3138
if __name__ == '__main__':
3239
import nose

src/_path.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ points_in_path(const void* const points, const size_t s0,
288288
no_nans_t no_nans_path(trans_path, true, path.has_curves());
289289
curve_t curved_path(no_nans_path);
290290
contour_t contoured_path(curved_path);
291-
contoured_path.width(fabs(r));
291+
contoured_path.width(r);
292292
point_in_path_impl(points, s0, s1, n, contoured_path, result);
293293
}
294294

0 commit comments

Comments
 (0)