meshpro / pygalmesh

:spider_web: A Python interface to CGAL's meshing tools
GNU General Public License v3.0
580 stars 57 forks source link

How to use optimesh to improve the result of pygalmesh? #166

Closed r03ert0 closed 2 years ago

r03ert0 commented 2 years ago

Hello, I'm generating a mesh from a polygon like this:

mesh = pygalmesh.generate_2d(
    contour,
    eds,
    max_edge_size=100,
    num_lloyd_steps=20,
)

I can get the vertices and triangles of the mesh using

verts, tris = mesh.points, mesh.cells[0][1]

How should I format the data to be able to use optimesh? I though I could just feed the points and cells objects:

result = optimesh.optimize_points_cells(mesh.points, mesh.cells, "CVT (block-diagonal)", 1.0e-5, 100)

...but that throws an error:

IndexError: arrays used as indices must be of integer (or boolean) type
nschloe commented 2 years ago

No idea what exactly is going wrong without an MWE.

nschloe commented 2 years ago

Closing for lack of response.