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

Skip to content

poisson point process with delaunay missing first triangle #72

@giovp

Description

@giovp

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions