# path contains_point IndexError: Unexpected SeqBase<T> length

I think I'm experiencing a bug.

Here is a minimum example:

import matplotlib.patches as mpatches
path = mpatches.Rectangle((0,0),width=1,height=1).get_path()
print path.contains_point(point=(.5,.5))

it raises an IndexError: Unexpected SeqBase<T> length.

I think this is a problem in the contains_point method which calls a C
function point_in_path inside of matplotlib._path

Thanks!
Gustavo

The problem is that the function in _path.cpp expects a path radius argument, r.

Here is the signature:
point_in_path(double x, double y, double r, PathIterator& path,
const agg::trans_affine& trans)

but the invocation in python looks like this:

point_in_path(point[0], point[1], self, transform)

···

On Sat, Jun 9, 2012 at 9:27 PM, Gustavo Goretkin <gustavo.goretkin@…287…> wrote:

I think I’m experiencing a bug.

Here is a minimum example:

import matplotlib.patches as mpatches

path = mpatches.Rectangle((0,0),width=1,height=1).get_path()

print path.contains_point(point=(.5,.5))

it raises an IndexError: Unexpected SeqBase length.

I think this is a problem in the contains_point method which calls a C

function point_in_path inside of matplotlib._path

Thanks!

Gustavo

I can't reproduce this on version >= 1.1.0. What version of matplotlib
are you using?

···

On 11 June 2012 17:23, Gustavo Goretkin <gustavo.goretkin@...287...> wrote:

The problem is that the function in _path.cpp expects a path radius
argument, r.

Here is the signature:
point_in_path(double x, double y, double r, PathIterator& path,
const agg::trans_affine& trans)

but the invocation in python looks like this:

point_in_path(point[0], point[1], self, transform)

On Sat, Jun 9, 2012 at 9:27 PM, Gustavo Goretkin > <gustavo.goretkin@...287...> wrote:

I think I'm experiencing a bug.

Here is a minimum example:

import matplotlib.patches as mpatches
path = mpatches.Rectangle((0,0),width=1,height=1).get_path()
print path.contains_point(point=(.5,.5))

it raises an IndexError: Unexpected SeqBase<T> length.

I think this is a problem in the contains_point method which calls a C
function point_in_path inside of matplotlib._path

Thanks!
Gustavo

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Unless someone undid the fix, this was already fixed in master, I believe. The current python invocation is:

result = point_in_path(point[0], point[1], radius, self, transform)

Ben Root

···

On Mon, Jun 11, 2012 at 12:23 PM, Gustavo Goretkin <gustavo.goretkin@…287…> wrote:

The problem is that the function in _path.cpp expects a path radius argument, r.

Here is the signature:
point_in_path(double x, double y, double r, PathIterator& path,
const agg::trans_affine& trans)

but the invocation in python looks like this:
point_in_path(point[0], point[1], self, transform)