Problem with contains() on an arrow

I’ve run into a strange problem with contains() on an arrow; there is a large area to the left of the arrow that insists that it is contained within the arrow. Small runnable sample attached.

I’ve looked at the path for the arrow, and it looks fine to me. I even went so far as to hack a STOP onto the end of the path, but that resulted in the same behavior.

Can anyone else confirm this behavior? matplotlib 1.1.1 is what I’m using. Seen on both Windows, Linux, and OSX.

arrow_contains_test.py (1.11 KB)

···


Daniel Hyams
dhyams@…287…

Hmm, I just found out that if I change path.Path.contains_point to use “point_on_path” instead of “point_in_path”, the containment tests work properly. I’m not that familiar with the path code…is the difference that one is testing for polygonal insideness, and one is testing for literally being on the “stroke”? If so, do we have to make sure that the proper one is called if there are no polygons involved in the path?

···

On Mon, Aug 20, 2012 at 9:28 PM, Daniel Hyams <dhyams@…287…> wrote:

I’ve run into a strange problem with contains() on an arrow; there is a large area to the left of the arrow that insists that it is contained within the arrow. Small runnable sample attached.

I’ve looked at the path for the arrow, and it looks fine to me. I even went so far as to hack a STOP onto the end of the path, but that resulted in the same behavior.

Can anyone else confirm this behavior? matplotlib 1.1.1 is what I’m using. Seen on both Windows, Linux, and OSX.


Daniel Hyams

dhyams@…287…


Daniel Hyams
dhyams@…287…

Bump for this topic; I’d still love to know what the right thing is to do here.

···

On Mon, Aug 20, 2012 at 10:08 PM, Daniel Hyams <dhyams@…287…> wrote:

Hmm, I just found out that if I change path.Path.contains_point to use “point_on_path” instead of “point_in_path”, the containment tests work properly. I’m not that familiar with the path code…is the difference that one is testing for polygonal insideness, and one is testing for literally being on the “stroke”? If so, do we have to make sure that the proper one is called if there are no polygons involved in the path?

On Mon, Aug 20, 2012 at 9:28 PM, Daniel Hyams <dhyams@…287…> wrote:

I’ve run into a strange problem with contains() on an arrow; there is a large area to the left of the arrow that insists that it is contained within the arrow. Small runnable sample attached.

I’ve looked at the path for the arrow, and it looks fine to me. I even went so far as to hack a STOP onto the end of the path, but that resulted in the same behavior.

Can anyone else confirm this behavior? matplotlib 1.1.1 is what I’m using. Seen on both Windows, Linux, and OSX.


Daniel Hyams

dhyams@…287…


Daniel Hyams
dhyams@…287…


Daniel Hyams
dhyams@…287…