Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poisson point process with delaunay missing first triangle #72

Closed
giovp opened this issue May 6, 2021 · 1 comment · Fixed by #73
Closed

poisson point process with delaunay missing first triangle #72

giovp opened this issue May 6, 2021 · 1 comment · Fixed by #73

Comments

@giovp
Copy link
Contributor

giovp commented May 6, 2021

was looking at the code and found an unexpected behaviour here:

return shape.find_simplex((x, y)) > 0

I'd expect that it should check for simplex >= 0.

example:

from pointpats.random import poisson
from scipy.spatial import delaunay_plot_2d, Delaunay, ConvexHull
import numpy as np
import matplotlib.pyplot as plt
rng = np.random.default_rng(10)
points = rng.uniform(0, 10, size=(30, 2))
hull = ConvexHull(points)
vxs = hull.points[hull.vertices]
deln = Delaunay(vxs)

ppp = poisson(hull, size=(100, 1))
fig, ax = plt.subplots(1, 1)
ax.scatter(
    points[..., 0],
    points[..., 1],
    edgecolor="b",
    facecolor="none",
    alpha=0.5,
)
ax.scatter(ppp[:, 0], ppp[:, 1], edgecolor="r", facecolor="none", alpha=0.5)
delaunay_plot_2d(deln)

image

looks like the first triangle is never covered, cause it is indexed as 0:

deln.find_simplex((2,8))
>>> array(0, dtype=int32)
@ljwolf
Copy link
Member

ljwolf commented May 6, 2021

Yes! that's correct! That should be >= 0.

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 a pull request may close this issue.

2 participants