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

computing volume of intersecting concave polyhedra #1186

Open
riyasamanta1 opened this issue Aug 27, 2024 · 1 comment
Open

computing volume of intersecting concave polyhedra #1186

riyasamanta1 opened this issue Aug 27, 2024 · 1 comment

Comments

@riyasamanta1
Copy link

Hi Marco,

Is there a way to compute the volume of the union and intersection of two polyhedra that can be concave or convex? I earlier considered using operations on the mesh defined from vertices and faces. However, it gives erroneous volumes (there might be an issue with face orientation; I am unsure what the issue is). My system contains both concave and convex polyhedra, so is there any simple tool in Vedo that would describe whether the faces are facing outward or not? I can write my code for convex polyhedra to check - but I don't know how to implement it for concave polyhedra.
So I am thinking of doing the intersection and union of two polyhedra using operations on volume.

vol1 = Mesh([vertices1,faces1]).binarize()
vol2 = Mesh([vertices2,faces2]).binarize()
vol_intersection = vol1.operation('and',vol2)
I am unsure to proceed further for vedo.volume.Volume object.

Could you guide me on how to find volume of vol_intersection? Thanks!

@marcomusy
Copy link
Owner

Hi the convention is that the outward face is the one that has the order of vertices anticlockwise. See:
examples/basic/buildmesh.py
with such convention the volume calculation should work!
You can also try to subdivide the mesh faces for better precision with eg:
mesh.sbudivide(3, method=1)
https://vedo.embl.es/autodocs/content/vedo/vedo/mesh.html#Mesh.subdivide

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

2 participants