Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

Volume of convex hull

Open josephinemonica opened this issue 6 years ago • 4 comments

Will be nice to have a volume attribute or method for convex hull object.

I tried to find the API for it, but could not find it.

josephinemonica avatar Jul 09 '20 09:07 josephinemonica

There is no such functionality at the moment. @josephinemonica would you be interested in contributing this method with our aid?

griegler avatar Jul 29 '20 09:07 griegler

Hey @griegler @kongsgard

First of all, thank you for your work in Open3D! :)

I've tried to use the PCD -> convex hull -> volume approach. However, It does not give me a good result. I have built a small test were I create a convex_hull for the points describing a cube of 1m³ but that gives me a volume of 0:

https://gist.github.com/JoseLlorensRipolles/fd3faa766527f1a3699eb58c985a30c0

I don't know if I am doing something wrong or if it is actually an error. If it is the later I would like to help you fix it.

Thank you in advance.

JoseLlorensRipolles avatar Feb 10 '21 16:02 JoseLlorensRipolles

If you visualize hull, you'll see that every other triangle is facing inwards and outwards. Coincidentally, they have the same area (which is used for the volume calculation), and thus the volume is computed to be 0. If you add the following line prior to computing the volume, you should get a volume of ~1:

hull.orient_triangles()

I agree that there should be a warning or error message when computing the volume for a mesh with arbitrarily oriented triangles, as in this case.

kongsgard avatar Feb 10 '21 18:02 kongsgard

It works like a charm. I'll open a issue to add the warning. Thank you!

JoseLlorensRipolles avatar Feb 10 '21 20:02 JoseLlorensRipolles