Volume of convex hull
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.
There is no such functionality at the moment. @josephinemonica would you be interested in contributing this method with our aid?
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.
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.
It works like a charm. I'll open a issue to add the warning. Thank you!