34 #if defined(SphericalHoughNormalVectorEstimator_RECURSES)
35 #error Recursive header files inclusion detected in SphericalHoughNormalVectorEstimator.h
38 #define SphericalHoughNormalVectorEstimator_RECURSES
40 #if !defined SphericalHoughNormalVectorEstimator_h
42 #define SphericalHoughNormalVectorEstimator_h
47 #include <DGtal/base/Common.h>
48 #include <DGtal/topology/SCellsFunctors.h>
50 #include "DGtal/geometry/tools/SphericalAccumulator.h"
52 #include "DGtal/math/linalg/SimpleMatrix.h"
83 template <
typename TSurfel,
typename TEmbedder>
106 const double minimalAspectRatio = 0.001,
107 const unsigned int nbTrials = 100,
108 const unsigned int accumulatorSize = 10,
109 const unsigned int nbAccumulators = 5) :
139 const double aDistance)
141 BOOST_VERIFY(aDistance == aDistance);
154 std::default_random_engine generator;
155 std::uniform_int_distribution<int> distribution(0,
156 static_cast<int>(
myPoints.size()) - 1 );
164 i = distribution(generator);
165 j = distribution(generator);
166 while ( (j = distribution(generator)) == i);
167 while (( (k = distribution(generator)) == i) || (k == j) );
195 return vote.getNormalized();
217 const double theta = (rand()+0.f)/RAND_MAX * 2* M_PI;
218 const double phi = (rand()+0.f)/RAND_MAX * 2* M_PI;
219 const double psi = (rand()+0.f)/RAND_MAX * 2* M_PI;
269 const unsigned int j,
270 const unsigned int k,
271 double &aspect)
const
282 const double a = u.norm() , b = v.norm();
283 const double c = w.norm();
284 const double s = (a+b+c)/2.0;
285 double denom = (8.0*(s-a)*(s-b)*(s-c));
286 if ( std::abs( denom ) <= std::abs( denom ) * 1e-6 )
289 aspect = a*b*c / denom;
291 return v.crossProduct(u);
335 #undef SphericalHoughNormalVectorEstimator_RECURSES
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
void setComponent(const DGtal::Dimension i, const DGtal::Dimension j, const Component &aValue)
Aim: This functor estimates normal vector for a collection of surfels using spherical accumulator bas...
const double myH
Grid step.
std::vector< RealPoint > myPoints
vector of embedded surfels
void pushSurfel(const Surfel &aSurf, const double aDistance)
std::vector< SphericalAccumulator< RealPoint > > myAccumulators
Spherical Accumulators.
SimpleMatrix< double, 3, 3 > Matrix
Matrix randomRotation() const
const unsigned int mySize
Size of the accumulator.
std::vector< Matrix > myInverseRotations
Random inverse rotations.
SCellEmbedder::RealPoint RealPoint
const SCellEmbedder * myEmbedder
Alias of the geometrical embedder.
Quantity getNormal(const unsigned int i, const unsigned int j, const unsigned int k, double &aspect) const
std::vector< Matrix > myRotations
Random rotations.
const unsigned int myNbAccumulators
Number of randomly shifted spherical accumulators to consider.
const unsigned int myNbTrials
Number of trials in the neignborhood.
SphericalHoughNormalVectorEstimator()=delete
SphericalHoughNormalVectorEstimator(ConstAlias< SCellEmbedder > anEmbedder, const double h, const double minimalAspectRatio=0.001, const unsigned int nbTrials=100, const unsigned int accumulatorSize=10, const unsigned int nbAccumulators=5)
const double myAspectRatio
Minimal aspect ratio (norm of the cross-product) to consider a given triangle.
PolygonalCalculus< SH3::RealPoint, SH3::RealVector >::Vector phi(const Face f)
DGtal is the top-level namespace which contains all DGtal functions and types.
PointVector< 3, double > RealPoint