32 #include "DGtal/base/Common.h"
33 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/base/BasicFunctors.h"
35 #include "DGtal/graph/GraphVisitorRange.h"
36 #include "DGtal/io/boards/Board2D.h"
37 #include "DGtal/io/Color.h"
38 #include "DGtal/io/colormaps/GradientColorMap.h"
39 #include "DGtal/shapes/Shapes.h"
40 #include "DGtal/topology/CanonicSCellEmbedder.h"
41 #include "DGtal/graph/DistanceBreadthFirstVisitor.h"
42 #include "DGtal/geometry/volumes/distance/LpMetric.h"
43 #include "DGtal/geometry/surfaces/estimation/LocalEstimatorFromSurfelFunctorAdapter.h"
44 #include "DGtal/geometry/surfaces/estimation/estimationFunctors/BasicEstimatorFromSurfelsFunctors.h"
45 #include "DGtal/topology/LightImplicitDigitalSurface.h"
46 #include "DGtal/geometry/surfaces/estimation/estimationFunctors/MongeJetFittingPrincipalCurvaturesEstimator.h"
47 #include "DGtal/geometry/surfaces/estimation/estimationFunctors/MongeJetFittingGaussianCurvatureEstimator.h"
48 #include "DGtal/geometry/surfaces/estimation/estimationFunctors/MongeJetFittingMeanCurvatureEstimator.h"
49 #include "DGtal/geometry/surfaces/estimation/estimationFunctors/MongeJetFittingNormalVectorEstimator.h"
50 #include "DGtal/geometry/surfaces/estimation/estimationFunctors/LinearLeastSquareFittingNormalVectorEstimator.h"
54 using namespace DGtal;
60 template <
typename TPo
int3>
61 struct ImplicitDigitalEllipse3 {
62 typedef TPoint3
Point;
64 ImplicitDigitalEllipse3(
double a,
double b,
double c )
65 : myA( a ), myB( b ), myC( c )
68 bool operator()(
const TPoint3 & p )
const
70 double x = ( (double) p[ 0 ] / myA );
71 double y = ( (double) p[ 1 ] / myB );
72 double z = ( (double) p[ 2 ] / myC );
73 return ( x*x + y*y + z*z ) <= 1.0;
85 unsigned int nbok = 0;
90 typedef ImplicitDigitalEllipse3<Point> ImplicitDigitalEllipse;
99 Point p1( -10, -10, -10 );
100 Point p2( 10, 10, 10 );
102 nbok +=
K.
init( p1, p2,
true ) ? 1 : 0;
104 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
105 <<
"K.init() is ok" << std::endl;
106 ImplicitDigitalEllipse ellipse( 6.0, 4.5, 3.4 );
108 SurfaceContainer* surfaceContainer =
new SurfaceContainer
129 FunctorGaussian estimatorK(embedder,1);
130 FunctorPrincipalCurvatures estimatork1k2(embedder,1);
131 FunctorMean estimatorH(embedder, 1);
132 FunctorNormal estimatorN(embedder,1);
133 FunctorNormalLeast estimatorL(embedder,1);
135 ConvFunctor convFunc(1.0);
137 Reporterk1k2 reporterk1k2;
139 ReporterNormal reporterN;
140 ReporterNormalLeast reporterL;
155 reporterK.setParams(l2, estimatorK, convFunc, 5.0);
156 reporterk1k2.setParams(l2, estimatork1k2, convFunc, 5.0);
157 reporterH.setParams(l2, estimatorH, convFunc, 5.0);
158 reporterN.setParams(l2, estimatorN, convFunc, 5.0);
159 reporterL.setParams(l2, estimatorL, convFunc, 5.0);
161 FunctorGaussian::Quantity valK = reporterK.eval(
surface.begin());
162 FunctorPrincipalCurvatures::Quantity valk1k2 = reporterk1k2.eval(
surface.begin());
163 FunctorMean::Quantity valH = reporterH.eval(
surface.begin());
164 FunctorNormal::Quantity valN = reporterN.eval(
surface.begin());
165 FunctorNormalLeast::Quantity valL = reporterL.eval(
surface.begin());
168 trace.
info() <<
"Gaussian = "<<valK <<std::endl;
169 trace.
info() <<
"k1 = " << valk1k2.first <<
" , k2 = " << valk1k2.second <<std::endl;
170 trace.
info() <<
"Mean = "<<valH<< std::endl;
171 trace.
info() <<
"Normal Vector (from Monge form) = "<<valN<< std::endl;
172 trace.
info() <<
"Normal Vector (linear least square) = "<<valL<< std::endl;
177 nbok +=
true ? 1 : 0;
179 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
180 <<
"true == true" << std::endl;
188 int main(
int argc,
char** argv )
192 for (
int i = 0; i < argc; ++i )
197 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
DigitalSurfaceContainer::Surfel Surfel
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.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Aim: this class adapts any local functor on digital surface element to define a local estimator....
Aim: implements l_p metrics.
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
void beginBlock(const std::string &keyword="")
Aim: Define a simple functor that returns a constant value (0 by default).
Aim: Estimates normal vector using CGAL linear least squares plane fitting.
Aim: Estimates Gaussian curvature using CGAL Jet Fitting and Monge Form.
Aim: Estimates Mean curvature using CGAL Jet Fitting and Monge Form.
Aim: Estimates normal vector using CGAL Jet Fitting and Monge Form.
Aim: Estimates Gaussian curvature using CGAL Jet Fitting and Monge Form.
CountedPtr< SH3::DigitalSurface > surface
SH3::DigitalSurface Surface
ExactPredicateLpSeparableMetric< Space, 2 > L2Metric
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.
int main(int argc, char **argv)
bool testLocalEstimatorFromFunctorAdapter()