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/graph/BreadthFirstVisitor.h"
37#include "DGtal/shapes/Shapes.h"
47 template <
typename KSpace,
typename Po
intPredicate>
50 const PointPredicate & pp,
56 unsigned int nbok = 0;
60 Boundary boundary(
K, pp,
63 trace.
beginBlock (
"Counting the number of surfels (breadth first traversal)" );
64 unsigned int nbsurfels = 0;
65 for (
ConstIterator it = boundary.begin(), it_end = boundary.end();
70 trace.
info() << nbsurfels <<
" surfels found." << std::endl;
71 nb++; nbok += nbsurfels == 354382 ? 1 : 0;
72 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
73 <<
"nbsurfels == 354382" << std::endl;
80 template <
typename TPo
int3>
81 struct ImplicitDigitalEllipse3 {
82 typedef TPoint3
Point;
84 ImplicitDigitalEllipse3(
double a,
double b,
double c )
85 : myA( a ), myB( b ), myC( c )
88 bool operator()(
const TPoint3 & p )
const
90 double x = ( (double) p[ 0 ] / myA );
91 double y = ( (double) p[ 1 ] / myB );
92 double z = ( (double) p[ 2 ] / myC );
93 return ( x*x + y*y + z*z ) <= 1.0;
102int main(
int,
char** )
105 typedef DGtal::ImplicitDigitalEllipse3<Point> ImplicitDigitalEllipse;
109 Point p1( -200, -200, -200 );
110 Point p2( 200, 200, 200 );
112 if (
K.
init( p1, p2,
true ) )
114 ImplicitDigitalEllipse ellipse( 180.0, 135.0, 102.0 );
121 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
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...
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
MyDigitalSurface::ConstIterator ConstIterator
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.
bool testLightImplicitDigitalSurface()