summaryrefslogtreecommitdiff
path: root/thirdparty/thekla_atlas/nvmath/ProximityGrid.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-04-19 11:42:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2019-04-19 11:42:58 +0200
commit6640f397f15b4179a7283b27c060d3f4f7c9917a (patch)
tree253f8d6f1b38ec07eade7e249472500174324699 /thirdparty/thekla_atlas/nvmath/ProximityGrid.h
parent1b3ea697c5dcbbb2feb0f96204de257532edaf0c (diff)
Drop unused thekla_atlas dependency
Since f12cb82 @reduz dropped the use of the thirdparty thekla_atlas library, which is replaced by xatlas. Fixes #28180. Fixes #28182.
Diffstat (limited to 'thirdparty/thekla_atlas/nvmath/ProximityGrid.h')
-rw-r--r--thirdparty/thekla_atlas/nvmath/ProximityGrid.h99
1 files changed, 0 insertions, 99 deletions
diff --git a/thirdparty/thekla_atlas/nvmath/ProximityGrid.h b/thirdparty/thekla_atlas/nvmath/ProximityGrid.h
deleted file mode 100644
index a21bb3bd68..0000000000
--- a/thirdparty/thekla_atlas/nvmath/ProximityGrid.h
+++ /dev/null
@@ -1,99 +0,0 @@
-#pragma once
-#ifndef NV_MATH_PROXIMITYGRID_H
-#define NV_MATH_PROXIMITYGRID_H
-
-#include "Vector.h"
-#include "ftoi.h"
-
-#include "nvcore/Array.inl"
-
-
-// A simple, dynamic proximity grid based on Jon's code.
-// Instead of storing pointers here I store indices.
-
-namespace nv {
-
- class Box;
-
- struct Cell {
- Array<uint> indexArray;
- };
-
- struct ProximityGrid {
- ProximityGrid();
-
- void reset();
- void init(const Array<Vector3> & pointArray);
- void init(const Box & box, uint count);
-
- int index_x(float x) const;
- int index_y(float y) const;
- int index_z(float z) const;
- int index(int x, int y, int z) const;
- int index(const Vector3 & pos) const;
-
- uint32 mortonCount() const;
- int mortonIndex(uint32 code) const;
-
- void add(const Vector3 & pos, uint key);
- bool remove(const Vector3 & pos, uint key);
-
- void gather(const Vector3 & pos, float radius, Array<uint> & indices);
-
- Array<Cell> cellArray;
-
- Vector3 corner;
- Vector3 invCellSize;
- int sx, sy, sz;
- };
-
- // For morton traversal, do:
- // for (int code = 0; code < mortonCount(); code++) {
- // int idx = mortonIndex(code);
- // if (idx < 0) continue;
- // }
-
-
-
- inline int ProximityGrid::index_x(float x) const {
- return clamp(ftoi_floor((x - corner.x) * invCellSize.x), 0, sx-1);
- }
-
- inline int ProximityGrid::index_y(float y) const {
- return clamp(ftoi_floor((y - corner.y) * invCellSize.y), 0, sy-1);
- }
-
- inline int ProximityGrid::index_z(float z) const {
- return clamp(ftoi_floor((z - corner.z) * invCellSize.z), 0, sz-1);
- }
-
- inline int ProximityGrid::index(int x, int y, int z) const {
- nvDebugCheck(x >= 0 && x < sx);
- nvDebugCheck(y >= 0 && y < sy);
- nvDebugCheck(z >= 0 && z < sz);
- int idx = (z * sy + y) * sx + x;
- nvDebugCheck(idx >= 0 && uint(idx) < cellArray.count());
- return idx;
- }
-
- inline int ProximityGrid::index(const Vector3 & pos) const {
- int x = index_x(pos.x);
- int y = index_y(pos.y);
- int z = index_z(pos.z);
- return index(x, y, z);
- }
-
-
- inline void ProximityGrid::add(const Vector3 & pos, uint key) {
- uint idx = index(pos);
- cellArray[idx].indexArray.append(key);
- }
-
- inline bool ProximityGrid::remove(const Vector3 & pos, uint key) {
- uint idx = index(pos);
- return cellArray[idx].indexArray.remove(key);
- }
-
-} // nv namespace
-
-#endif // NV_MATH_PROXIMITYGRID_H