69 typedef VisitorRange::ConstIterator VisitorConstIterator;
73 typedef MyIICurvatureFunctor::Value
Value;
77 double realValue = 1.0/(radius * radius);
84 dshape.
init( Z3i::RealPoint( -10.0, -10.0, -10.0 ), Z3i::RealPoint( 10.0, 10.0, 10.0 ), h );
89 trace.
error() <<
"Problem with Khalimsky space" << std::endl;
101 VisitorRange range(
new Visitor( surf, *surf.
begin() ));
102 VisitorConstIterator ibegin = range.begin();
103 VisitorConstIterator iend = range.end();
105 MyIICurvatureFunctor curvatureFunctor;
106 curvatureFunctor.init( h, re );
108 MyIICurvatureEstimator curvatureEstimator( curvatureFunctor );
109 curvatureEstimator.attach(
K, dshape );
110 curvatureEstimator.setParams( re/h );
111 curvatureEstimator.init( h, ibegin, iend );
117 std::vector< Value > results;
118 std::back_insert_iterator< std::vector< Value > > resultsIt( results );
119 curvatureEstimator.eval( ibegin, iend, resultsIt );
123 trace.
beginBlock (
"Comparing results of integral invariant 3D Gaussian curvature ..." );
126 unsigned int rsize =
static_cast<unsigned int>(results.size());
130 trace.
error() <<
"ERROR: surface is empty" << std::endl;
135 for (
unsigned int i = 0; i < rsize; ++i )
137 mean += results[ i ];
143 trace.
error() <<
"ERROR: result is NaN" << std::endl;
148 double v = std::abs ( realValue - mean );
150 trace.
warning() <<
"True value: " << realValue << std::endl;
152 trace.
warning() <<
"Delta: " << delta <<
" |true - mean|: " << v << std::endl;
171 typedef VisitorRange::ConstIterator VisitorConstIterator;
175 typedef MyIICurvatureFunctor::Value
Value;
179 typedef MyIICurvatureFunctorTensor::Value ValueTensor;
189 dshape.
init( Z3i::RealPoint( -10.0, -10.0, -10.0 ), Z3i::RealPoint( 10.0, 10.0, 10.0 ), h );
194 trace.
error() <<
"Problem with Khalimsky space" << std::endl;
206 VisitorRange range(
new Visitor( surf, *surf.
begin() ));
207 VisitorConstIterator ibegin = range.begin();
208 VisitorConstIterator iend = range.end();
210 MyIICurvatureFunctor curvatureFunctor;
211 curvatureFunctor.init( h, re );
212 MyIICurvatureEstimator curvatureEstimator( curvatureFunctor );
213 curvatureEstimator.attach(
K, dshape );
214 curvatureEstimator.setParams( re/h );
215 curvatureEstimator.init( h, ibegin, iend );
217 MyIICurvatureFunctorTensor curvatureFunctorTensor;
218 curvatureFunctorTensor.init( h, re );
219 MyIICurvatureEstimatorTensor curvatureEstimatorTensor( curvatureFunctorTensor );
220 curvatureEstimatorTensor.attach(
K, dshape );
221 curvatureEstimatorTensor.setParams( re/h );
222 curvatureEstimatorTensor.init( h, ibegin, iend );
228 std::vector< Value > results;
229 std::back_insert_iterator< std::vector< Value > > resultsIt( results );
230 curvatureEstimator.eval( ibegin, iend, resultsIt );
236 Value val = curvatureEstimator.eval( surf.
begin() );
237 ValueTensor valTensor = curvatureEstimatorTensor.eval( surf.
begin() );
238 bool ok = (val.first == std::get<0>(valTensor));
239 ok &= (val.second == std::get<1>(valTensor));
241 trace.
error()<<
"Error comparing principal curvatures between two different functors."<<std::endl;
246 trace.
beginBlock (
"Comparing results of integral invariant 3D Gaussian curvature ..." );
248 unsigned int error_order = 0;
249 unsigned int rsize =
static_cast<unsigned int>(results.size());
253 trace.
error() <<
"ERROR: surface is empty" << std::endl;
258 for (
unsigned int i = 0; i < rsize; ++i )
260 if( std::abs(results[i].first) < std::abs(results[i].second) )
266 trace.
warning() <<
"Error order: " << error_order << std::endl;
267 trace.
warning() <<
"If not equals to 0, something is wrong..." << std::endl;
271 if( error_order != 0 )
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.