Skip to content

Path.intersects_path returns True when it shouldn't #15842

@QuLogic

Description

@QuLogic

Bug report

Bug summary

Path.intersects_path returns True for the following paths, when they don't intersect at all (as shown by Shapely). This is a simplified outline_path from Cartopy. The trigger seems to be the duplicate point at the end of outline_path; if removed, it works as expected.

A bisect says this broke in bd3fd8f, which is a backport of #11553 to 3.1.0. cc @TarasKuzyo

Code for reproduction

import numpy as np
import matplotlib as mpl
from matplotlib.path import Path
from shapely.geometry import LinearRing


this_path = Path(
    np.array([
        [824.85064295, 2056.26489203],
        [861.69033931, 2041.00539016],
        [868.57864109, 2057.63522175],
        [831.73894473, 2072.89472361],
        [824.85064295, 2056.26489203]]),
    np.array([1, 2, 2, 2, 79], dtype=Path.code_type))
this_ring = LinearRing(this_path.vertices)

outline_path = Path(
    np.array([
        [859.91051028, 2165.38461538],
        [859.06772495, 2149.30331334],
        [859.06772495, 2181.46591743],
        [859.91051028, 2165.38461538],
        [859.91051028, 2165.38461538]]),
    np.array([1, 2, 2, 2, 2],
             dtype=Path.code_type))
outline_ring = LinearRing(outline_path.vertices)

print(mpl.__version__, outline_path.intersects_path(this_path),
      outline_ring.intersects(this_ring))

Actual outcome

3.1.2 True False

Expected outcome

3.1.2 False False

Matplotlib version

  • Operating system: Fedora 30
  • Matplotlib version: 3.1.2
  • Matplotlib backend (print(matplotlib.get_backend())): N/A
  • Python version: 3.7
  • Jupyter version (if applicable): N/A
  • Other libraries: N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy