Skip to content

address nan's in pslg#9

Merged
krober10nd merged 2 commits intomasterfrom
nan_fix
Jul 30, 2021
Merged

address nan's in pslg#9
krober10nd merged 2 commits intomasterfrom
nan_fix

Conversation

@krober10nd
Copy link
Collaborator

@krober10nd krober10nd commented May 21, 2021

* Tries to fix #8
@krober10nd
Copy link
Collaborator Author

krober10nd commented May 22, 2021

Okay here's a complex NaN-delimited polygon to test with.

import numpy as np
import matplotlib.pyplot as plt
 
from inpoly import inpoly2
 
nan = np.nan
 
points = np.loadtxt("qp.txt")
node = np.loadtxt("poly.txt")
edge = np.loadtxt("e.txt", dtype=int)
 
IN, ON = inpoly2(points, node, edge)
 
fig, ax = plt.subplots()
plt.plot(points[IN == 1, 0], points[IN == 1, 1], "b.")
plt.plot(points[IN == 0, 0], points[IN == 0, 1], "r.")
plt.plot(points[ON == 1, 0], points[ON == 1, 1], "ms")
 
ax.set_aspect("equal", adjustable="box")
plt.show()

This should produce (if the changes in this PR are not used the answer is incorrect).

correct

qp.txt

poly.txt

e.txt

`vert` does not require `nanmin` or `nanmax` as the edge array should ensure that nan's in the array is not the case.
@krober10nd
Copy link
Collaborator Author

@dengwirda do you have comments on this?

@krober10nd krober10nd requested a review from dengwirda July 29, 2021 01:52
@krober10nd krober10nd merged commit fa16417 into master Jul 30, 2021
@krober10nd krober10nd deleted the nan_fix branch July 30, 2021 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NaN-delimited polygons failure

1 participant