summaryrefslogtreecommitdiff
path: root/thirdparty/thekla_atlas/nvmesh/geometry/Bounds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/thekla_atlas/nvmesh/geometry/Bounds.cpp')
-rw-r--r--thirdparty/thekla_atlas/nvmesh/geometry/Bounds.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/thirdparty/thekla_atlas/nvmesh/geometry/Bounds.cpp b/thirdparty/thekla_atlas/nvmesh/geometry/Bounds.cpp
new file mode 100644
index 0000000000..69fd1deb24
--- /dev/null
+++ b/thirdparty/thekla_atlas/nvmesh/geometry/Bounds.cpp
@@ -0,0 +1,54 @@
+// This code is in the public domain -- Ignacio CastaƱo <castano@gmail.com>
+
+#include "nvmesh.h" // pch
+
+#include "Bounds.h"
+
+#include "nvmesh/BaseMesh.h"
+#include "nvmesh/halfedge/Mesh.h"
+#include "nvmesh/halfedge/Vertex.h"
+
+#include "nvmath/Box.inl"
+
+using namespace nv;
+
+Box MeshBounds::box(const BaseMesh * mesh)
+{
+ nvCheck(mesh != NULL);
+
+ Box bounds;
+ bounds.clearBounds();
+
+ const uint vertexCount = mesh->vertexCount();
+ for (uint v = 0; v < vertexCount; v++)
+ {
+ const BaseMesh::Vertex & vertex = mesh->vertexAt(v);
+ bounds.addPointToBounds( vertex.pos );
+ }
+
+ return bounds;
+}
+
+Box MeshBounds::box(const HalfEdge::Mesh * mesh)
+{
+ nvCheck(mesh != NULL);
+
+ Box bounds;
+ bounds.clearBounds();
+
+ const uint vertexCount = mesh->vertexCount();
+ for (uint v = 0; v < vertexCount; v++)
+ {
+ const HalfEdge::Vertex * vertex = mesh->vertexAt(v);
+ nvDebugCheck(vertex != NULL);
+ bounds.addPointToBounds( vertex->pos );
+ }
+
+ return bounds;
+}
+
+/*Sphere MeshBounds::sphere(const HalfEdge::Mesh * mesh)
+{
+ // @@ TODO
+ return Sphere();
+}*/