8000 TST: a 0 length segment does not intersect with all other segments · matplotlib/matplotlib@a06d8e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit a06d8e9

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

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

lib/matplotlib/tests/test_path.py

Lines 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