33#include "DGtal/base/Common.h"
34#include "DGtal/shapes/implicit/ImplicitBall.h"
35#include "DGtal/shapes/GaussDigitizer.h"
36#include "DGtal/topology/LightImplicitDigitalSurface.h"
37#include "DGtal/topology/DigitalSurface.h"
38#include "DGtal/topology/UmbrellaComputer.h"
59 typedef Boundary::Surfel
Surfel;
60 typedef Boundary::DigitalSurfaceTracker DigitalSurfaceTracker;
64 unsigned int nbok = 0;
69 EuclideanShape ball( c, 2 );
79 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
80 <<
"K.init() is ok" << std::endl;
92 DigitalSurfaceTracker* ptrTracker = boundary.newTracker( bel );
93 MyUmbrellaComputer umbrella;
98 umbrella.init( *ptrTracker, k,
true, j );
99 unsigned int nb_forward = 0;
106 bel = umbrella.surfel();
107 }
while ( bel != init_bel );
110 unsigned int nb_backward = 0;
116 bel = umbrella.surfel();
117 }
while ( bel != init_bel );
118 nb++; nbok += nb_forward == nb_backward ? 1 : 0;
120 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
121 <<
" nb_forward(" << nb_forward
122 <<
") == nb_backward(" << nb_backward <<
")"
125 unsigned int nbsurfels = 0;
126 for (
ConstIterator it = boundary.begin(), it_end = boundary.end();
131 trace.
info() << nbsurfels <<
" surfels found." << std::endl;
150 typedef Boundary::Surfel
Surfel;
158 unsigned int nbok = 0;
163 EuclideanShape ball( c, 8 );
173 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
174 <<
"K.init() is ok" << std::endl;
178 Boundary boundary(
K,
188 for ( MyDigitalSurface::FaceSet::const_iterator it = all_faces.begin(),
189 it_end = all_faces.end(); it != it_end; ++it )
191 std::cerr <<
" face=" <<
K.
sKCoords( digSurf.
pivot( *it ) ) <<
":";
192 std::cerr <<
"(" << it->nbVertices <<
")" << (it->isClosed() ?
"C":
"O");
194 for (
unsigned int i = 0; i < vtx.size(); ++i )
196 std::cerr <<
" " <<
K.
sKCoords( vtx[ i ] );
198 std::cerr << std::endl;
205 unsigned int nbvtcs = 0;
206 unsigned int nbarcs = 0;
207 unsigned int nbfaces = 0;
208 for (
ConstIterator it = boundary.begin(), it_end = boundary.end();
209 it != it_end; ++it, ++nbvtcs )
213 for (
unsigned int i = 0; i < arcs.size(); ++i, ++nbarcs )
215 const Arc & arc = arcs[ i ];
218 for (
unsigned int j = 0; j < faces.size(); ++j, ++nbfaces )
220 const Face & face = faces[ j ];
225 while ( ( k < vertices.size() ) && ( vertices[ k ] != vtx ) )
228 if ( k == vertices.size() )
229 trace.
info() <<
"Error at vertex " << vtx
230 <<
". Vertex not found in incident face."
234 if ( digSurf.
head( arc ) != vertices[ (k+1) % vertices.size() ] )
235 trace.
info() <<
"Error at vertex " << vtx
236 <<
". Arc is not in incident face."
242 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
243 <<
"Tested nbvtcs=" << nbvtcs
244 <<
" nbarcs=" << nbarcs
245 <<
" nbfaces=" << nbfaces
249 trace.
beginBlock(
"Testing block ... export as OFF: ex-digital-surface.off" );
250 ofstream fout(
"ex-digital-surface.off" );
258 unsigned int nbsurfels = 0;
259 for (
ConstIterator it = boundary.begin(), it_end = boundary.end();
264 trace.
info() << nbsurfels <<
" surfels found." << std::endl;
274int main(
int argc,
char** argv )
278 for (
int i = 0; i < argc; ++i )
284 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...
ArcRange outArcs(const Vertex &v) const
void exportSurfaceAs3DOFF(std::ostream &out) const
SCell pivot(const Face &f) const
Surfel Vertex
Defines the type for a vertex.
std::vector< Vertex > VertexRange
The range of vertices is defined as a vector.
std::vector< Arc > ArcRange
The range of arcs is defined as a vector.
std::vector< Face > FaceRange
The range of faces is defined as a vector.
VertexRange verticesAroundFace(const Face &f) const
std::set< Face > FaceSet
The set of faces is defined as set.
FaceRange facesAroundArc(const Arc &a) const
Vertex head(const Arc &a) const
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
void attach(ConstAlias< EuclideanShape > shape)
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
const Point & lowerBound() const
const Point & upperBound() const
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
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.
DirIterator sDirs(const SCell &p) const
Given a signed cell [p], returns an iterator to iterate over each coordinate the cell spans.
const Point & sKCoords(const SCell &c) const
Return its Khalimsky coordinates.
typename PreCellularGridSpace::DirIterator DirIterator
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Aim: Implements basic operations that will be used in Point and Vector classes.
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="")
Aim: Useful for computing umbrellas on 'DigitalSurface's, ie set of n-1 cells around a n-3 cell.
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
HyperRectDomain< Space > Domain
bool testCombinatorialSurface()
bool testUmbrellaComputer()