2

I would like to use pygalmesh (a Python frontend to CGALs mesh generation capabilities) to perform boolean operations on a custom domain. The website gives an example for defining custom domains by using custom level set functions here (another one can be found here).

What I need is a function to generate a domain from a list of vertices and respective edges.

Any hints/ideas are appreciated.

Thanks

mnolde
  • 125
  • 1
  • 1
  • 5

1 Answers1

2

Package author here.

What I need is a function to generate a domain from a list of vertices and respective edges.

pygalmesh is not suited for the task. It can create meshes only from three-dimensional geometries that are described by (a combination of) level-set functions.

If you only have vertices, it isn't entirely clear what the corresponding domain should be. Perhaps the convex hull of that domain? Also, edges don't do much in 3D.

If you have the surface of your domain given by points and facets, pygalmesh can fill in the volume via

import pygalmesh

mesh = pygalmesh.generate_volume_mesh_from_surface_mesh(
    "elephant.vtu",
    facet_angle=25.0,
    facet_size=0.15,
    facet_distance=0.008,
    cell_radius_edge_ratio=3.0,
    verbose=False
)
Nico Schlömer
  • 53,797
  • 27
  • 201
  • 249
  • Thank you very much! Regarding your proposal, I'm fine with using surface meshes. However, I don't seem to be able to get boolean operations working on them. _pygalmesh.Difference_ seems to expect objects of type _pygalmesh.DomainBase only. If I calculate the difference of the _elephant.vtu_ mentioned above and a ball domain, I get: _error - incompatible constructor arguments_. Did I do something wrong? – mnolde Oct 06 '19 at 18:47
  • You need to _have_ a surface mesh from elsewhere. pygalmesh can construct a volume mesh from it, it _cannot_ build said surface mesh. – Nico Schlömer Oct 07 '19 at 08:01