inducer / inducer/meshpy

Delaunay triangulation on 2D data using meshpy

Open
#62 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
588
Forks
112
Avg merge
9h 38m
Merged PRs (30d)
2

Description

Hi! Thanks for writing this package!

I'm wanting to perform Delaunay triangulation on (large, ~10 million) 2D scatter points, for purposes of interpolation of new points. I was intending to benchmark meshpy / triangle's implementation, but I'm not sure how to get it to work!

With [Scipy's Delaunay function](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.Delaunay.html) (based on qhull), one gives it a number of points and it returns (among other things) a list of integers, where each row lists the indices of the three points that are connected to the point associated with the row index (that sentence came out possibly a bit confusing).

But how does one do something similar with meshpy?

```python
points = np.array([[0, 0], [0, 1.1], [1, 0], [1, 1]])
from scipy.spatial import Delaunay
tri = Delaunay(points)
tri.vertices
array([[2, 3, 0],
[3, 1, 0]], dtype=int32)
```

I can't seem to get any output when trying the following, and I am not sure how to proceed.
```python
points = np.array([[0, 0], [0, 1.1], [1, 0], [1, 1]])

mesh_info = MeshInfo()
mesh_info.set_points(points)
mesh = build(mesh_info)
print(np.array(mesh.neighbors))
print(np.array(mesh.facets))
print(np.array(mesh.faces))
print(np.array(mesh.elements))
print(np.array(mesh.points))
print(np.array(mesh.element_volumes))
print(np.array(mesh.point_attributes))
# all return []
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.