#include "DGtal/shapes/parametric/Ball3D.h"
#include "DGtal/shapes/GaussDigitizer.h"
#include "DGtal/topology/LightImplicitDigitalSurface.h"
#include "DGtal/topology/DigitalSurface.h"
#include "DGtal/graph/DepthFirstVisitor.h"
#include "DGtal/graph/GraphVisitorRange.h"
#include "DGtal/geometry/surfaces/estimation/IIGeometricFunctors.h"
#include "DGtal/geometry/surfaces/estimation/IntegralInvariantCovarianceEstimator.h"
int main(
int argc,
char** argv )
{
const double h = 1;
const double radiusBall = 12.0;
const double radiusII = 6;
const double trueAreaSurface = 4.0*M_PI*radiusBall*radiusBall;
h );
LightDigitalSurface lightDigitalSurface( kspace, digitalBall, surfelAdjacency, bel );
SurfelConstIterator sbegin = graphVisitorRange.
begin();
SurfelConstIterator send = graphVisitorRange.
end();
std::vector< Surfel > v_border;
while( sbegin != send )
{
v_border.push_back( *sbegin );
++sbegin;
}
typedef IIGeometricFunctors::IINormalDirectionFunctor< Z3i::Space > NormalFunctor;
NormalFunctor normalFunctor;
IINormalEstimator normalEstimator( normalFunctor );
normalEstimator.attach( kspace, digitalBall );
normalEstimator.setParams( radiusII / h );
normalEstimator.init( h, v_border.begin(), v_border.end() );
double areaSurfaceEstimated = 0.0;
for( unsigned int i_position = 0; i_position < v_border.size(); ++i_position )
{
Z3i::RealPoint normalEstimated = normalEstimator.eval( &(v_border[i_position]) );
areaSurfaceEstimated += std::abs( normalEstimated.
dot( normalSurfel )) * h * h;
}
trace.
info() <<
"Area Surface estimated : " << areaSurfaceEstimated << std::endl;
trace.
info() <<
"True areaSurface : " << trueAreaSurface << std::endl;
trace.
info() <<
"Ratio : " << areaSurfaceEstimated / trueAreaSurface << std::endl;
return 0;
}