1 #ifndef _OPENGR_ALGO_PAIRCREATIONFUNCTOR_H 2 #define _OPENGR_ALGO_PAIRCREATIONFUNCTOR_H 6 #include "gr/utils/shared.h" 8 #include "gr/accelerators/pairExtraction/bruteForceFunctor.h" 9 #include "gr/accelerators/pairExtraction/intersectionFunctor.h" 10 #include "gr/accelerators/pairExtraction/intersectionPrimitive.h" 11 #include "gr/algorithms/match4pcsBase.h" 15 template <
typename PointType,
typename _Scalar,
typename FilterFunctor,
typename Options>
19 using Scalar = _Scalar;
21 using VectorType =
typename PointType::VectorType;
22 using BaseCoordinates =
typename Traits4pcs<PointType>::Coordinates;
23 using OptionType = Options;
46 BaseCoordinates base_3D_;
47 int base_point1_, base_point2_;
55 const OptionType& options,
56 const std::vector<PointType>& Q)
58 pairs(NULL), _ratio(1.f)
62 inline Point worldToUnit(
64 static const Point half = Point::Ones() * Scalar(0.5f);
65 return (p-_gcenter) / _ratio + half;
72 static const Point half = Point::Ones() * Scalar(0.5f);
73 return (p - half) * _ratio + _gcenter;
83 return unitToWorld(points[i]);
91 Eigen::AlignedBox<_Scalar, 3> bbox;
93 unsigned int nSamples = Q_.size();
95 points.reserve(nSamples);
96 primitives.reserve(nSamples);
100 for (
unsigned int i = 0; i < nSamples; ++i) {
101 const VectorType &q = Q_[i].pos();
106 _gcenter = bbox.center();
108 _ratio = bbox.diagonal().maxCoeff() + 0.001;
113 for (
unsigned int i = 0; i < nSamples; ++i) {
114 points[i] = worldToUnit(points[i]);
116 primitives.emplace_back(points[i], Scalar(1.));
122 const Scalar nRadius = radius/_ratio;
123 for(
typename std::vector< Primitive >::iterator it = primitives.begin();
124 it != primitives.end(); ++it)
125 (*it).radius() = nRadius;
132 inline void setBase(
int base_point1,
int base_point2,
133 const BaseCoordinates& base_3D){
135 base_point1_ = base_point1;
136 base_point2_ = base_point2;
138 segment1 = (base_3D_[base_point2_]->pos() -
139 base_3D_[base_point1_]->pos()).normalized();
149 const PointType& p = Q_[j];
150 const PointType& q = Q_[i];
157 const Scalar distance = (q.pos() - p.pos()).norm();
162 std::pair<
bool,
bool> res = fun(p,q, pair_normals_angle, *base_3D_[base_point1_], *base_3D_[base_point2_], options_);
164 pairs->emplace_back(i, j);
166 pairs->emplace_back(j, i);
PairCreationFunctor(const OptionType &options, const std::vector< PointType > &Q)
Definition: pairCreationFunctor.h:54
double pair_normals_angle
Definition: pairCreationFunctor.h:28
void endPrimitiveCollect(int)
Definition: pairCreationFunctor.h:144
const std::vector< PointType > & Q_
Definition: pairCreationFunctor.h:30
Point getPointInWorldCoord(int i) const
Definition: pairCreationFunctor.h:82
Definition: pairCreationFunctor.h:16
Scalar unitToWorld(Scalar d) const
Definition: pairCreationFunctor.h:77
void synch3DContent()
Definition: pairCreationFunctor.h:87
OptionType options_
Definition: pairCreationFunctor.h:26
std::vector< typename PairCreationFunctor::Point > points
Definition: pairCreationFunctor.h:41
std::vector< unsigned int > ids
Definition: pairCreationFunctor.h:34
static constexpr int size()
Definition: match4pcsBase.h:27
std::vector< Primitive > primitives
Definition: pairCreationFunctor.h:42
void process(int i, int j)
Definition: pairCreationFunctor.h:147
void setRadius(Scalar radius)
Definition: pairCreationFunctor.h:121
Definition: intersectionPrimitive.h:60
void setBase(int base_point1, int base_point2, const BaseCoordinates &base_3D)
Definition: pairCreationFunctor.h:132
void beginPrimitiveCollect(int)
Definition: pairCreationFunctor.h:143
Eigen::Matrix< Scalar, 3, 1 > Point
Definition: pairCreationFunctor.h:38
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
double pair_distance
Definition: pairCreationFunctor.h:27
Scalar getNormalizedEpsilon(Scalar eps)
Definition: pairCreationFunctor.h:128
PairsVector * pairs
Definition: pairCreationFunctor.h:32
Point unitToWorld(const Eigen::MatrixBase< typename PairCreationFunctor::Point > &p) const
Definition: pairCreationFunctor.h:70
HyperSphere< typename PairCreationFunctor::Point, 3, Scalar > Primitive
Definition: pairCreationFunctor.h:39
double pair_distance_epsilon
Definition: pairCreationFunctor.h:29