dengwirda / inpoly-python

A fast 'point(s)-in-polygon' test for Python.
Other
25 stars 5 forks source link

Resolution issue #16

Closed mta102 closed 8 months ago

mta102 commented 1 year ago

xmin, xmax, ymin, ymax = 0, 0.00002, 0, 0.00002 x0, y0, x1, y1 = 0.00005, 0.00005, 0, 1

define any n-sided polygon

p = np.array([[xmin, ymin], [xmax, ymin], [xmax, ymax], [xmin, ymax], [xmin, ymin]])

define some coords

coords = np.array([[x0, y0], [x1, y1]])

get boolean mask for points if in or on polygon perimeter

isin, ison = inpoly2(coords, p) isin.sum()

krober10nd commented 1 year ago

Sorry what's the issue exactly?

Have you read the docstring?

   STAT, BNDS = INPOLY2(..., FTOL) also returns an N-by-1
    boolean array BNDS, with BNDS[II] = TRUE if VERT[II, :]
    lies "on" a boundary segment, where FTOL is a floating-
    point tolerance for boundary comparisons. By default,
    FTOL ~ EPS ^ 0.85.
dengwirda commented 8 months ago

Closing --- not clear there's an issue, though note that the polygon is defined with duplicate nodes.