Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b5a6e3

Browse files
committed
Change nxutils.points_inside_poly to return an array of bool, not int.
svn path=/trunk/matplotlib/; revision=6191
1 parent af50cbb commit 0b5a6e3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/nxutils.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pnpoly(PyObject *self, PyObject *args)
4545
if (! PyArg_ParseTuple(args, "ddO", &x, &y, &vertsarg))
4646
return NULL;
4747

48-
verts = (PyArrayObject *) PyArray_FromObject(vertsarg,PyArray_DOUBLE, 2, 2);
48+
verts = (PyArrayObject *) PyArray_FromObject(vertsarg,NPY_DOUBLE, 2, 2);
4949

5050
if (verts == NULL)
5151
{
@@ -113,7 +113,7 @@ points_inside_poly(PyObject *self, PyObject *args)
113113
if (! PyArg_ParseTuple(args, "OO", &xypointsarg, &vertsarg))
114114
return NULL;
115115

116-
verts = (PyArrayObject *) PyArray_FromObject(vertsarg,PyArray_DOUBLE, 2, 2);
116+
verts = (PyArrayObject *) PyArray_FromObject(vertsarg, NPY_DOUBLE, 2, 2);
117117

118118
if (verts == NULL)
119119
{
@@ -158,7 +158,7 @@ points_inside_poly(PyObject *self, PyObject *args)
158158
//printf("adding vert: %1.3f, %1.3f\n", xv[i], yv[i]);
159159
}
160160

161-
xypoints = (PyArrayObject *) PyArray_FromObject(xypointsarg,PyArray_DOUBLE, 2, 2);
161+
xypoints = (PyArrayObject *) PyArray_FromObject(xypointsarg, NPY_DOUBLE, 2, 2);
162162

163163
if (xypoints == NULL)
164164
{
@@ -187,7 +187,7 @@ points_inside_poly(PyObject *self, PyObject *args)
187187
npoints = xypoints->dimensions[0];
188188
dimensions[0] = npoints;
189189

190-
mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions,PyArray_INT);
190+
mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions, NPY_BOOL);
191191
if (mask==NULL) {
192192
Py_XDECREF(verts);
193193
Py_XDECREF(xypoints);
@@ -200,7 +200,7 @@ points_inside_poly(PyObject *self, PyObject *args)
200200
y = *(double *)(xypoints->data + i*xypoints->strides[0] + xypoints->strides[1]);
201201
b = pnpoly_api(npol, xv, yv, x, y);
202202
//printf("checking %d, %d, %1.3f, %1.3f, %d\n", npol, npoints, x, y, b);
203-
*(int *)(mask->data+i*mask->strides[0]) = b;
203+
*(char *)(mask->data + i*mask->strides[0]) = b;
204204

205205
}
206206

0 commit comments

Comments
 (0)