Added ComputeMeshVolume to the Stat<> class

This commit is contained in:
Paolo Cignoni 2016-01-30 23:09:05 +00:00
parent e8c27766a7
commit ceaa1c7ffb
1 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,7 @@
#include <vcg/complex/algorithms/closest.h> #include <vcg/complex/algorithms/closest.h>
#include <vcg/space/index/grid_static_ptr.h> #include <vcg/space/index/grid_static_ptr.h>
#include <vcg/complex/algorithms/update/topology.h> #include <vcg/complex/algorithms/update/topology.h>
#include <vcg/complex/algorithms/inertia.h>
namespace vcg { namespace vcg {
@ -163,6 +164,11 @@ public:
return barycenter/areaSum; return barycenter/areaSum;
} }
static ScalarType ComputeMeshVolume(MeshType & m)
{
Inertia<MeshType> I(m);
return I.Mass();
}
static ScalarType ComputeMeshArea(MeshType & m) static ScalarType ComputeMeshArea(MeshType & m)
{ {