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

Volume or related statistics of the Intersection, union and difference objects #131

Open
anish-pratheepkumar opened this issue Mar 8, 2021 · 5 comments

Comments

@anish-pratheepkumar
Copy link

anish-pratheepkumar commented Mar 8, 2021

Hi,
I have recently started working with 3D meshes and I need to find intersection of two 3D volumes. They are defined as 3D points in space, in a numpy array. (I was working with Trimesh initially and created 3D .STL meshes for these two 3D volumes, but I couldnt find any option to find intersection between these two 3D meshes. Hence I switched to pygalmesh)

I referred to the following codes from this github repo:
to generate mesh from numpy array: https://github.com/nschloe/pygalmesh#meshes-from-numpy-arrays-representing-3d-images
to find intersection of two meshes: https://github.com/nschloe/pygalmesh#domain-combinations

In the end I got an Intersection object and I would like to know its properties like its volume for example. Is there any possibility for that in pygalmesh? Or please let me know how to figure out these properties of a mesh.

@nschloe
Copy link
Collaborator

nschloe commented Mar 8, 2021

Domain combinations are only for domains which are explicitly specified, not implicitly by a numpy array. If you have the domain data as arrays, and they have the same shape, it should be easy to find the intersection of the domain with some logical operations. You can pass the resulting array to pygalmesh.

After you've generated the mesh, to get the volume you can simply sum up the volumes of the tetrahedra. There are a number of libraries to compute those, e.g., meshplex, but you can also do it yourself.

@Igiteverything
Copy link

I have the same problem as Anish, and would like to ask: Given that CGAL provides the functions for boolean operations on surface meshes ( https://doc.cgal.org/latest/Polygon_mesh_processing/index.html#Coref_section ), wouldn't it be very useful to include them in pygalmesh? I am sure many users would really appreciate, and it is a functionality hardly available in any other python packages (trimesh does not have a good intersection implementation, for instance).

@nschloe
Copy link
Collaborator

nschloe commented Mar 9, 2021

@Igiteverything Sure, I'll be happy to review a PR!

@Igiteverything
Copy link

Touché.

@nschloe
Copy link
Collaborator

nschloe commented Mar 15, 2021

Touché.

?

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

No branches or pull requests

3 participants