33#include "DGtal/base/Common.h"
34#include "DGtal/kernel/SpaceND.h"
35#include "DGtal/kernel/domains/DomainPredicate.h"
36#include "DGtal/kernel/domains/HyperRectDomain.h"
37#include "DGtal/kernel/sets/DigitalSetSelector.h"
38#include "DGtal/kernel/sets/DigitalSetConverter.h"
39#include "DGtal/topology/MetricAdjacency.h"
40#include "DGtal/topology/DomainAdjacency.h"
41#include "DGtal/topology/DigitalTopology.h"
42#include "DGtal/topology/Object.h"
43#include "DGtal/graph/Expander.h"
44#include "DGtal/io/boards/Board2D.h"
117 typedef Z2::Point
Point;
127 Point p1 ( -20, -10 );
143 if ( ( x*x + y*y < 82 ) ||
144 ( ( x - 14 ) * ( x - 14 ) + ( y + 1 ) * ( y + 1 ) < 17 ) ||
145 ( ( x + 14 ) * ( x + 14 ) + ( y - 1 ) * ( y - 1 ) < 17 ) )
149 ObjectType bubble ( dt8_4, bubble_set );
152 if (bubble.computeConnectedness() ==
CONNECTED)
153 trace.
info() <<
"The object is (8,4)connected." << endl;
155 trace.
info() <<
"The object is not (8,4)connected." << endl;
158 ObjectType bubbleBorder = bubble.border();
159 if (bubbleBorder.computeConnectedness() ==
CONNECTED)
160 trace.
info() <<
"The object (8,4) border is connected." << endl;
162 trace.
info() <<
"The object (8,4) border is not connected." << endl;
169 board.
saveSVG (
"bubble-set.svg" );
171 board <<
SetMode( bubbleBorder.className(),
"DrawAdjacencies" )
174 board.
saveSVG (
"bubble-object-border.svg" );
181 DT8_4::ReverseTopology dt4_8 = dt8_4.reverseTopology();
183 ObjectType48 bubble2 ( dt4_8, bubble_set );
186 ObjectType48 bubbleBorder2 = bubble2.border();
187 if (bubbleBorder2.computeConnectedness() ==
CONNECTED)
188 trace.
info() <<
"The object (4,8) border is connected." << endl;
190 trace.
info() <<
"The object (4,8) border is not connected." << endl;
194 <<
SetMode( bubbleBorder2.className(),
"DrawAdjacencies" )
198 board.
saveSVG (
"bubble-object-border-48.svg" );
201 vector<ObjectType48> borders ( 30 );
202 vector<ObjectType48>::iterator it = borders.begin();
203 auto nbComponents = bubbleBorder2.writeComponents ( it );
205 trace.
info() <<
"The Bubble object has " << nbComponents <<
" (4,8)-connected components" << endl;
208 for (
unsigned int k = 0;k < nbComponents ; k++ )
217 board.
saveSVG (
"bubble-object-color-borders-48.svg" );
235 typedef Z2::Point
Point;
245 Point p1 ( -20, -10 );
261 if ( ( x*x + y*y < 82 ) ||
262 ( ( x - 14 ) * ( x - 14 ) + ( y + 1 ) * ( y + 1 ) < 17 ) ||
263 ( ( x + 14 ) * ( x + 14 ) + ( y - 1 ) * ( y - 1 ) < 17 ) )
267 ObjectType bubble ( dt8_4, bubble_set );
270 if (bubble.computeConnectedness() ==
CONNECTED)
271 trace.
info() <<
"The object is (8,4)connected." << endl;
273 trace.
info() <<
"The object is not (8,4)connected." << endl;
276 ObjectType bubbleBorder = bubble.border();
277 if (bubbleBorder.computeConnectedness() ==
CONNECTED)
278 trace.
info() <<
"The object (8,4) border is connected." << endl;
280 trace.
info() <<
"The object (8,4) border is not connected." << endl;
291 board.
saveSVG (
"bubble-set-dgtalboard.svg" );
293 board <<
SetMode( bubbleBorder.className(),
"DrawAdjacencies" )
296 board.
saveSVG (
"bubble-object-border-dgtalboard.svg" );
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
std::string className() const
void insertNew(const Point &p)
Aim: Represents a digital topology as a couple of adjacency relations.
Iterator for HyperRectDomain.
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
const ConstIterator & begin() const
std::string className() const
const ConstIterator & end() const
Aim: Describes digital adjacencies in digital spaces that are defined with the 1-norm and the infinit...
Aim: An object (or digital object) represents a set in some digital space associated with a digital t...
void beginBlock(const std::string &keyword="")
Board & setPenColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
void clear(const DGtal::Color &color=DGtal::Color::None)
Board & setFillColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Board & setLineWidth(double width)
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Board & setLineStyle(Shape::LineStyle style)
DGtal is the top-level namespace which contains all DGtal functions and types.
DigitalSetByAssociativeContainer< Domain, std::unordered_set< typename Domain::Point > > Type
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Struct representing a 2D point.
virtual void setStyle(Board2D &aboard) const
virtual void setStyle(Board2D &aboard) const
virtual void setStyle(Board2D &aboard) const
virtual void setStyle(Board2D &aboard) const
virtual void setStyle(Board2D &aboard) const
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet