diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-12-08 11:58:37 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-08 11:58:37 -0300 |
commit | 372b79b0d324b1eeb5991eb510726420c7cbb12d (patch) | |
tree | 533b0acfc41971f8d46bdd7139a379a0f2ba39d5 /thirdparty/thekla_atlas/nvmesh/geometry/Bounds.cpp | |
parent | 8c78ccb027635702a2d69ebb7ad6a6ddfaf5ffa1 (diff) | |
parent | bf05309af734431c3b3cf869a63ed477439a6739 (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.cpp | 54 |
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(); +}*/ |