• Advertisement
Sign in to follow this  

Volume of a polyhedron

This topic is 2238 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,
I have to make a project for my university in C++. I use visual studio 2010.
In a part of that project I need to calculate the volume of polyhedrons.
Is there any algorithm for that or any example, which it could help me?
I have already calculated the edges and the vertices of my polyhedron, and draw it with directX.
But how can I calculate the polyhedron's volume?
Any help would be very appreciated cause I'm not so experienced programmer and I have short deadline.
With regards,
Dimitris

Share this post


Link to post
Share on other sites
Advertisement
i guess you can split the surface into triangles. then choose a point inside the polyhedron and all triangles + that point give you tetrahedrons which have easy to calculate volume and over which you can do a summation.

Share this post


Link to post
Share on other sites
Thank you for the answer!
Yes, I have the triangle list!! And because my polyhedron is convex-yes the solution you suggested to me is perfect!!
Thank you again!!
smile.png

Share this post


Link to post
Share on other sites
As a sidenote: if i remember correctly it actually even works with arbitrary points (even outside the polyhedron) and nonconvex shapes if you do "signed" volumes and are careful with the orientation of your triangles/tetrahedrons.

Share this post


Link to post
Share on other sites

As a sidenote: if i remember correctly it actually even works with arbitrary points (even outside the polyhedron) and nonconvex shapes if you do "signed" volumes and are careful with the orientation of your triangles/tetrahedrons.


Yes, this works. In particular, you can take the point to be the origin, and then the volume is just the sum of the determinants of the 3x3 matrices formed by the coordinates of the three points of each face, divided by 6. If you have non-triangular faces, just divide them up into triangles (and you can do this in some naive way ignoring possible concavities, and it will still work).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement