summaryrefslogtreecommitdiff
path: root/thirdparty/thekla_atlas/nvmesh/geometry/Bounds.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-12-08 11:58:37 -0300
committerGitHub <noreply@github.com>2017-12-08 11:58:37 -0300
commit372b79b0d324b1eeb5991eb510726420c7cbb12d (patch)
tree533b0acfc41971f8d46bdd7139a379a0f2ba39d5 /thirdparty/thekla_atlas/nvmesh/geometry/Bounds.cpp
parent8c78ccb027635702a2d69ebb7ad6a6ddfaf5ffa1 (diff)
parentbf05309af734431c3b3cf869a63ed477439a6739 (diff)
Merge pull request #14409 from hpvb/import-thekla-atlas
Import thekla_atlas
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();
+}*/