openscenegraph / OpenSceneGraph

OpenSceneGraph git repository
http://www.openscenegraph.org
Other
3.25k stars 1.42k forks source link

Want to calculate Support Volume of 3-D Mesh #1266

Open Vipul-M-Rawal opened 1 year ago

Vipul-M-Rawal commented 1 year ago

Hi, I want to calculate the support volume of 3-D mesh. I tried to find a direct method to get or calculate the support volume. Can you help me to check that is there any direct method to get or calculate the support volume of a 3-D mesh?

robertosfield commented 1 year ago

I can't figure out what you mean. What is a support volume? What do you mean by a 3-D mesh? Perhaps if you give a bit more context others might be able to figure what you might be look for.

Vipul-M-Rawal commented 1 year ago

I apologize for any confusion. Let me clarify. By "support volume", I was referring to the volume enclosed by a convex polyhedron that we obtained by taking an STL file, computing its convex hull, projecting this convex hull onto the X-Y plane, and then joining the projected hull with the original one.

Regarding "3-D mesh", in the context of our discussion and in general computational geometry, it refers to a collection of vertices, edges, and faces that define the shape of a 3D object in space. The STL file I mentioned is a common format that represents such a 3-D mesh.

I hope this provides a clearer picture of what I was discussing. Let me know if you have any more questions!

robertosfield commented 1 year ago

What is sounds like is the volume enclosed by a manifold geometry - I recall doing this previously but don't remember enough what code might be doing it, may not be in the OSG at all.

Essentially what you do is for each triangle in the mesh that makes up the manifold geometry is compute the volume underneath the triangle and the base plane, if the normal of the triangle is pointing upwards then treat it's volume as positive, if the normal is pointing downwards then downwards then treat it's volume as negative. Sum it all up and you get the volume enclosed by the mesh.

A convex hull is a special case of manifold geometry so works just fine with this technique.

As a general comment meshes in the OSG, or the even it's successor the VSG, are stored for the purpose of rendering so just have vertices and the indices connecting them together to make triangles etc. There edges are not stored explicitly.