48 #ifndef _SUPER4PCS_ACCELERATORS_INDEXED_NORMAL_SET_H_ 49 #define _SUPER4PCS_ACCELERATORS_INDEXED_NORMAL_SET_H_ 51 #include "super4pcs/utils/disablewarnings.h" 52 #include "super4pcs/accelerators/utils.h" 72 typedef std::array< std::vector<unsigned int>,
79 #define VALIDATE_INDICES true 80 #pragma message "Index validation is enabled in debug mode" 82 #define VALIDATE_INDICES false 87 std::vector<AngularGrid*> _grid;
92 inline int indexPos (
const Point& p)
const;
94 inline int indexNormal(
const Point& n)
const;
97 inline Point coordinatesPos (
const Point& p)
const 98 {
return p/_epsilon; }
100 inline Point coordinatesNormal(
const Point& n)
const 102 static const Point half = Point::Ones()/
Scalar(2.);
103 return (n/
Scalar(2.) + half)/_nepsilon;
107 inline int indexCoordinatesPos (
const Point& pCoord)
const;
109 inline int indexCoordinatesNormal(
const Point& nCoord)
const;
115 : _epsilon(epsilon) {
117 const int gridDepth = -std::log2(epsilon);
118 _egSize = std::pow(2,gridDepth);
119 _epsilon = 1.f/_egSize;
121 _grid = std::vector<AngularGrid*> (std::pow(_egSize, dim), NULL);
133 const int pId = indexPos(p);
134 if (pId == -1)
return NULL;
140 std::vector<unsigned int>&nei);
144 std::vector<unsigned int>&nei);
149 std::vector<unsigned int>&nei,
150 bool tryReverse =
false);
155 #include "super4pcs/accelerators/normalset.hpp" 157 #endif // _INDEXED_NORMAL_SET_H_ IndexedNormalSet(const Scalar epsilon)
Definition: normalset.h:114
Normal set indexed by a position in euclidean space.
Definition: normalset.h:71
virtual ~IndexedNormalSet()
Definition: normalset.hpp:62
MOVE_DIR
Definition: normalset.h:75
bool addElement(const Point &pos, const Point &normal, unsigned int id)
Add a new couple pos/normal, and its associated id.
Definition: normalset.hpp:116
Definition: normalset.h:75
constexpr baseT POW(baseT base, expoT expo)
Compile time pow.
Definition: utils.h:62
std::array< std::vector< unsigned int >, Utils::POW(_ngSize, dim)> AngularGrid
Definition: normalset.h:73
Definition: normalset.h:75
_Scalar Scalar
Definition: normalset.h:76
void getNeighbors(const Point &p, std::vector< unsigned int > &nei)
Get closest points in euclidean space.
Definition: normalset.hpp:136
AngularGrid * angularGrid(const Point &p)
Definition: normalset.h:132