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

Appearance settings

Commit a06d8e9

Browse filesBrowse files
committed
TST: a 0 length segment does not intersect with all other segments
1 parent 31ba9ff commit a06d8e9
Copy full SHA for a06d8e9

File tree

Expand file treeCollapse file tree

1 file changed

+43
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+43
-0
lines changed

‎lib/matplotlib/tests/test_path.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_path.py
+43Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,3 +352,46 @@ def test_full_arc(offset):
352352
maxs = np.max(path.vertices, axis=0)
353353
np.testing.assert_allclose(mins, -1)
354354
np.testing.assert_allclose(maxs, 1)
355+
356+
357+
def test_disjoint_zero_length_segment():
358+
this_path = Path(
359+
np.array([
360+
[824.85064295, 2056.26489203],
361+
[861.69033931, 2041.00539016],
362+
[868.57864109, 2057.63522175],
363+
[831.73894473, 2072.89472361],
364+
[824.85064295, 2056.26489203]]),
365+
np.array([1, 2, 2, 2, 79], dtype=Path.code_type))
366+
367+
outline_path = Path(
368+
np.array([
369+
[859.91051028, 2165.38461538],
370+
[859.06772495, 2149.30331334],
371+
[859.06772495, 2181.46591743],
372+
[859.91051028, 2165.38461538],
373+
[859.91051028, 2165.38461538]]),
374+
np.array([1, 2, 2, 2, 2],
375+
dtype=Path.code_type))
376+
377+
assert not outline_path.intersects_path(this_path)
378+
assert not this_path.intersects_path(outline_path)
379+
380+
381+
def test_intersect_zero_length_segment():
382+
this_path = Path(
383+
np.array([
384+
[0, 0],
385+
[1, 1],
386+
]))
387+
388+
outline_path = Path(
389+
np.array([
390+
[1, 0],
391+
[.5, .5],
392+
[.5, .5],
393+
[0, 1],
394+
]))
395+
396+
assert outline_path.intersects_path(this_path)
397+
assert this_path.intersects_path(outline_path)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.