48 #ifndef _OPENGR_ACCELERATORS_INDEXED_NORMAL_SET_H_ 49 #define _OPENGR_ACCELERATORS_INDEXED_NORMAL_SET_H_ 51 #include "gr/utils/disablewarnings.h" 52 #include "gr/accelerators/utils.h" 80 using Scalar = _Scalar;
84 #define VALIDATE_INDICES true 85 #pragma message "Index validation is enabled in debug mode" 87 #define VALIDATE_INDICES false 91 const Scalar _nepsilon;
97 inline int indexPos (
const Point& p)
const;
99 inline int indexNormal(
const Point& n)
const;
102 inline Point coordinatesPos (
const Point& p)
const 103 {
return p/_epsilon; }
105 inline Point coordinatesNormal(
const Point& n)
const 107 static const Point half = Point::Ones()/Scalar(2.);
108 return (n/Scalar(2.) + half)/_nepsilon;
112 inline int indexCoordinatesPos (
const Point& pCoord)
const;
114 inline int indexCoordinatesNormal(
const Point& nCoord)
const;
120 : _nepsilon(Scalar(1.)/Scalar(_ngSize) + 0.00001),
124 const int gridDepth = -std::log2(epsilon);
125 _egSize = std::pow(2,gridDepth);
126 _epsilon = 1.f/_egSize;
128 _grid = std::vector<AngularGrid*> (std::pow(_egSize, dim), NULL);
140 const int pId = indexPos(p);
141 if (pId == -1)
return NULL;
147 std::vector<AngularGrid*> buf;
148 const int pId = indexPos(p);
150 gr::Utils::OneRingNeighborhood neiFun;
152 neiFun.get<dim>( pId, _egSize, arr );
153 buf.reserve(arr.size());
154 for (
auto& id : arr){
155 if ( id != -1 && _grid[id] != nullptr){
156 buf.push_back(_grid[id]);
165 std::vector<
unsigned int>&nei);
180 #include "gr/accelerators/normalset.hpp" bool addElement(const Point &pos, const Point &normal, unsigned int id)
Add a new couple pos/normal, and its associated id.
Definition: normalset.hpp:113
IndexedNormalSet(const Scalar epsilon)
Definition: normalset.h:119
Definition: normalset.h:79
AngularGrid * angularGrid(const Point &p)
Definition: normalset.h:139
MOVE_DIR
Definition: normalset.h:79
virtual ~IndexedNormalSet()
Definition: normalset.hpp:59
Definition: normalset.h:79
void getNeighbors(const Point &p, std::vector< unsigned int > &nei)
Get closest points in euclidean space.
Definition: normalset.hpp:145
CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts... >::Scalar ComputeTransformation(const InputRange1 &P, const InputRange2 &Q, Eigen::Ref< typename CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts... >::MatrixType > transformation, const Sampler< PointType > &sampler, TransformVisitor &v)
Definition: congruentSetExplorationBase.hpp:61
void getNeighbors(const Point &p, const Point &n, Scalar alpha, std::vector< unsigned int > &nei, bool tryReverse=false)
Get closest poitns in euclidean an normal space with angular deviation.
Definition: normalset.hpp:177
std::vector< AngularGrid * > angularGrids(const Point &p)
Definition: normalset.h:146