diff options
Diffstat (limited to 'thirdparty/thekla_atlas/nvmesh/geometry/Measurements.cpp')
-rw-r--r-- | thirdparty/thekla_atlas/nvmesh/geometry/Measurements.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/thirdparty/thekla_atlas/nvmesh/geometry/Measurements.cpp b/thirdparty/thekla_atlas/nvmesh/geometry/Measurements.cpp new file mode 100644 index 0000000000..e0c271663b --- /dev/null +++ b/thirdparty/thekla_atlas/nvmesh/geometry/Measurements.cpp @@ -0,0 +1,36 @@ +// This code is in the public domain -- castano@gmail.com + +#include "nvmesh.h" // pch + +#include "Measurements.h" +#include "nvmesh/halfedge/Mesh.h" +#include "nvmesh/halfedge/Face.h" + +using namespace nv; + +float nv::computeSurfaceArea(const HalfEdge::Mesh * mesh) +{ + float area = 0; + + for (HalfEdge::Mesh::ConstFaceIterator it(mesh->faces()); !it.isDone(); it.advance()) + { + const HalfEdge::Face * face = it.current(); + area += face->area(); + } + nvDebugCheck(area >= 0); + + return area; +} + +float nv::computeParametricArea(const HalfEdge::Mesh * mesh) +{ + float area = 0; + + for (HalfEdge::Mesh::ConstFaceIterator it(mesh->faces()); !it.isDone(); it.advance()) + { + const HalfEdge::Face * face = it.current(); + area += face->parametricArea(); + } + + return area; +} |