32 #include "DGtal/base/Common.h" 
   33 #include "DGtal/topology/DigitalSurface.h" 
   34 #include "DGtal/topology/DigitalSetBoundary.h" 
   35 #include "DGtal/topology/LightImplicitDigitalSurface.h" 
   36 #include "DGtal/topology/BreadthFirstVisitor.h" 
   37 #include "DGtal/shapes/Shapes.h" 
   41 using namespace DGtal;
 
   47   template <
typename KSpace, 
typename Po
intPredicate>
 
   49   testLightImplicitDigitalSurface( 
const KSpace & K, 
 
   50                                    const PointPredicate & pp,
 
   51                                    const typename KSpace::Surfel & bel )
 
   53     typedef typename KSpace::Point 
Point;
 
   54     typedef typename KSpace::Surfel Surfel;
 
   56     typedef typename Boundary::SurfelConstIterator ConstIterator;
 
   57     typedef typename Boundary::Tracker Tracker;
 
   59     unsigned int nbok = 0;
 
   63     Boundary boundary( K, pp,
 
   66     trace.
beginBlock ( 
"Counting the number of surfels (breadth first traversal)" );
 
   67     unsigned int nbsurfels = 0;
 
   68     for ( ConstIterator it = boundary.begin(), it_end = boundary.end();
 
   73     trace.
info() << nbsurfels << 
" surfels found." << std::endl;
 
   74     nb++, nbok += nbsurfels == 354382 ? 1 : 0;
 
   75     trace.
info() << 
"(" << nbok << 
"/" << nb << 
") " 
   76                    << 
"nbsurfels == 354382" << std::endl;
 
   83   template <
typename TPo
int3>
 
   88       : myA( a ), myB( b ), myC( c )
 
   91     bool operator()( 
const TPoint3 & p )
 const 
   93       double x = ( (double) p[ 0 ] / myA );
 
   94       double y = ( (double) p[ 1 ] / myB );
 
   95       double z = ( (double) p[ 2 ] / myC );
 
   96     return ( x*x + y*y + z*z ) <= 1.0;
 
  105 int main( 
int, 
char** )
 
  109   typedef KSpace::SCell Surfel;
 
  112   Point p1( -200, -200, -200 );
 
  113   Point p2( 200, 200, 200 );
 
  115   if ( K.init( p1, p2, 
true ) )
 
  117       ImplicitDigitalEllipse ellipse( 180.0, 135.0, 102.0 );
 
  119       res = testLightImplicitDigitalSurface<KSpace, ImplicitDigitalEllipse>
 
  124   trace.
emphase() << ( res ? 
"Passed." : 
"Error." ) << endl;