#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;
Shape ball( center, radiusBall );
typedef DigitalShape::Domain
Domain;
DigitalShape digitalBall;
digitalBall.attach( ball );
digitalBall.init( ball.getLowerBound() -
Z3i::RealPoint( 1.0, 1.0, 1.0 ),
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;
}
trace.
beginBlock(
"Computation with normal estimation ..." );
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;
}
Aim: Model of the concept StarShaped3D represents any Sphere in the space.
Aim: This class is useful to perform a depth-first exploration of a graph given a starting point or s...
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
ConstIterator begin() const
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Aim: Transforms a graph visitor into a single pass input range.
ConstIterator begin() const
ConstIterator end() const
Aim: This class implement an Integral Invariant estimator which computes for each surfel the covarian...
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Dimension sOrthDir(const SCell &s) const
Given a signed surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel is c...
const Point & sKCoords(const SCell &c) const
Return its Khalimsky coordinates.
SCell sDirectIncident(const SCell &p, Dimension k) const
Return the direct incident cell of [p] along [k] (the incident cell along [k])
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Aim: Implements basic operations that will be used in Point and Vector classes.
PointVector< dim, double, std::array< double, dim > > getNormalized() const
auto dot(const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::dotProduct(*this, v))
Dot product with a PointVector.
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
HyperRectDomain< Space > Domain