32#include "DGtal/base/Common.h"
33#include "DGtal/topology/DigitalSurface.h"
34#include "DGtal/topology/DigitalSetBoundary.h"
35#include "DGtal/topology/ImplicitDigitalSurface.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,
64 trace.
beginBlock (
"Counting the number of surfels (breadth first traversal)" );
65 unsigned int nbsurfels = 0;
66 for (
ConstIterator it = boundary.begin(), it_end = boundary.end();
71 trace.
info() << nbsurfels <<
" surfels found." << std::endl;
72 nb++; nbok += nbsurfels == 354382 ? 1 : 0;
73 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
74 <<
"nbsurfels == 354382" << std::endl;
81 template <
typename TPo
int3>
82 struct ImplicitDigitalEllipse3 {
83 typedef TPoint3
Point;
85 ImplicitDigitalEllipse3(
double a,
double b,
double c )
86 : myA( a ), myB( b ), myC( c )
89 bool operator()(
const TPoint3 & p )
const
91 double x = ( (double) p[ 0 ] / myA );
92 double y = ( (double) p[ 1 ] / myB );
93 double z = ( (double) p[ 2 ] / myC );
94 return ( x*x + y*y + z*z ) <= 1.0;
103int main(
int ,
char** )
106 typedef DGtal::ImplicitDigitalEllipse3<Point> ImplicitDigitalEllipse;
110 Point p1( -200, -200, -200 );
111 Point p2( 200, 200, 200 );
113 if (
K.
init( p1, p2,
true ) )
115 ImplicitDigitalEllipse ellipse( 180.0, 135.0, 102.0 );
123 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
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.
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 testImplicitDigitalSurface()