114 trace.beginBlock (
"Testing Object Borders in 2D ..." );
117 typedef Z2::Point
Point;
127 Point p1 ( -20, -10 );
139 for ( DomainConstIterator it =
domain.begin(); it !=
domain.end(); ++it )
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" );
231 trace.beginBlock (
"Testing Board2D with Object Borders in 2D ..." );
235 typedef Z2::Point
Point;
245 Point p1 ( -20, -10 );
257 for ( DomainConstIterator it =
domain.begin(); it !=
domain.end(); ++it )
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: Parallelepidec region of a digital space, model of a 'CDomain'.