DGtal  1.2.0
Functions
testCOBANaivePlaneComputer.cpp File Reference
#include <cstdlib>
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/kernel/CPointPredicate.h"
#include "DGtal/geometry/surfaces/CAdditivePrimitiveComputer.h"
#include "DGtal/geometry/surfaces/COBANaivePlaneComputer.h"
#include "DGtal/geometry/surfaces/COBAGenericNaivePlaneComputer.h"
Include dependency graph for testCOBANaivePlaneComputer.cpp:

Go to the source code of this file.

Functions

template<typename Integer >
Integer getRandomInteger (const Integer &first, const Integer &after_last)
 
template<typename Integer , typename NaivePlaneComputer >
bool checkPlane (Integer a, Integer b, Integer c, Integer d, int diameter, unsigned int nbtries)
 
template<typename Integer , typename GenericNaivePlaneComputer >
bool checkGenericPlane (Integer a, Integer b, Integer c, Integer d, int diameter, unsigned int nbtries)
 
template<typename Integer , typename NaivePlaneComputer >
bool checkPlanes (unsigned int nbplanes, int diameter, unsigned int nbtries)
 
bool testCOBANaivePlaneComputer ()
 
template<typename NaivePlaneComputer >
bool checkManyPlanes (unsigned int diameter, unsigned int nbplanes, unsigned int nbpoints)
 
template<typename NaivePlaneComputer >
unsigned int maxDiameter (unsigned int min, unsigned int max)
 
template<typename GenericNaivePlaneComputer >
bool checkExtendWithManyPoints (unsigned int diameter, unsigned int nbplanes, unsigned int nbpoints)
 
int main (int, char **)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Jacques-Olivier Lachaud (jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr ) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
Date
2012/03/05

Functions for testing class COBANaivePlaneComputer.

This file is part of the DGtal library.

Definition in file testCOBANaivePlaneComputer.cpp.

Function Documentation

◆ checkExtendWithManyPoints()

template<typename GenericNaivePlaneComputer >
bool checkExtendWithManyPoints ( unsigned int  diameter,
unsigned int  nbplanes,
unsigned int  nbpoints 
)

Definition at line 408 of file testCOBANaivePlaneComputer.cpp.

411 {
412  unsigned int nbok = 0;
413  unsigned int nb = 0;
415  typedef typename GenericNaivePlaneComputer::Point Point;
416  typedef typename Point::Coordinate PointInteger;
418 
419  trace.beginBlock( "checkExtendWithManyPoints" );
420  for ( unsigned int j = 0; j < nbplanes; ++j )
421  {
422  Integer a = getRandomInteger<Integer>( (Integer) 0, (Integer) diameter / 2 );
423  Integer b = getRandomInteger<Integer>( (Integer) 0, (Integer) diameter / 2 );
424  Integer c = getRandomInteger<Integer>( (Integer) 1, (Integer) diameter / 2 );
425  Integer d = getRandomInteger<Integer>( (Integer) 0, (Integer) diameter / 2 );
426  GenericNaivePlaneComputer plane;
427  Dimension axis;
428  if ( ( a >= b ) && ( a >= c ) ) axis = 0;
429  else if ( ( b >= a ) && ( b >= c ) ) axis = 1;
430  else axis = 2;
431  plane.init( diameter, 1, 1 );
432 
433  std::vector<Point> pts;
434  for ( unsigned int i = 0; i < nbpoints; ++i )
435  {
436  Point p;
437  p[ 0 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
438  p[ 1 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
439  p[ 2 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
440  Integer x = (Integer) p[ 0 ];
441  Integer y = (Integer) p[ 1 ];
442  Integer z = (Integer) p[ 2 ];
443  switch( axis ) {
444  case 0: p[ 0 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break;
445  case 1: p[ 1 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break;
446  case 2: p[ 2 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break;
447  }
448  pts.push_back( p );
449  }
450  ++nb; nbok += plane.isExtendable( pts.begin(), pts.end() ); // should be ok
451  trace.info() << "(" << nbok << "/" << nb
452  << ") plane.isExtendable( pts.begin(), pts.end() )"
453  << std::endl;
454  Point & any0 = pts[ getRandomInteger<int>( 0, pts.size() ) ];
455  pts.push_back( any0 + Point(1,0,0) );
456  Point & any1 = pts[ getRandomInteger<int>( 0, pts.size() ) ];
457  pts.push_back( any1 + Point(0,1,0) );
458  Point & any2 = pts[ getRandomInteger<int>( 0, pts.size() ) ];
459  pts.push_back( any2 + Point(0,0,1) );
460  bool check = ! plane.isExtendable( pts.begin(), pts.end() ); // should not be ok
461  ++nb; nbok += check ? 1 : 0;
462  trace.info() << "(" << nbok << "/" << nb
463  << ") ! plane.isExtendable( pts.begin(), pts.end() )"
464  << std::endl;
465  if ( ! check )
466  trace.warning() << plane << " last=" << pts.back() << std::endl
467  << "a=" << a << " b=" << b << " c=" << c << " d=" << d << std::endl;
468  ++nb; nbok += plane.extend( pts.begin(), pts.end() - 3 ); // should be ok
469  trace.info() << "(" << nbok << "/" << nb
470  << ") plane.extend( pts.begin(), pts.end() - 3)"
471  << std::endl;
472  ++nb; nbok += ! plane.extend( pts.end() - 3, pts.end() ); // should not be ok
473  trace.info() << "(" << nbok << "/" << nb
474  << ") ! plane.extend( pts.end() - 3, pts.end() )"
475  << std::endl;
476  }
477  trace.endBlock();
478  return nb == nbok;
479 }
Integer ceilDiv(IntegerParamType na, IntegerParamType nb) const
void beginBlock(const std::string &keyword="")
std::ostream & info()
std::ostream & warning()
double endBlock()
DGtal::int64_t InternalInteger
DGtal::uint32_t Dimension
Definition: Common.h:137
Trace trace
Definition: Common.h:154
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:533
MyPointD Point
Definition: testClone2.cpp:383

References DGtal::Trace::beginBlock(), DGtal::IntegerComputer< TInteger >::ceilDiv(), DGtal::Trace::endBlock(), DGtal::Trace::info(), DGtal::trace, and DGtal::Trace::warning().

Referenced by main().

◆ checkGenericPlane()

template<typename Integer , typename GenericNaivePlaneComputer >
bool checkGenericPlane ( Integer  a,
Integer  b,
Integer  c,
Integer  d,
int  diameter,
unsigned int  nbtries 
)

Checks the naive plane d <= ax+by+cz <= d + max(|a|,|b|,|c|)-1

Definition at line 158 of file testCOBANaivePlaneComputer.cpp.

160 {
161  typedef typename GenericNaivePlaneComputer::Point Point;
162  typedef typename Point::Component PointInteger;
164  Integer absA = ic.abs( a );
165  Integer absB = ic.abs( b );
166  Integer absC = ic.abs( c );
167  Integer x, y, z;
168  Dimension axis;
169  if ( ( absA >= absB ) && ( absA >= absC ) )
170  axis = 0;
171  else if ( ( absB >= absA ) && ( absB >= absC ) )
172  axis = 1;
173  else
174  axis = 2;
175  Point p;
176  GenericNaivePlaneComputer plane;
177  plane.init( diameter, 1, 1 );
178  // Checks that points within the naive plane are correctly recognized.
179  unsigned int nb = 0;
180  unsigned int nbok = 0;
181  while ( nb != nbtries )
182  {
183  p[ 0 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
184  p[ 1 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
185  p[ 2 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
186  x = (Integer) p[ 0 ];
187  y = (Integer) p[ 1 ];
188  z = (Integer) p[ 2 ];
189  switch ( axis ) {
190  case 0: p[ 0 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break;
191  case 1: p[ 1 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break;
192  case 2: p[ 2 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break;
193  }
194  bool ok_ext = plane.isExtendable( p ); // should be ok
195  bool ok = plane.extend( p ); // should be ok
196  ++nb; nbok += ok_ext ? 1 : 0;
197  ++nb; nbok += ok ? 1 : 0;
198  if ( ! ok )
199  {
200  std::cerr << "[ERROR] p=" << p << " NOT IN plane=" << plane << std::endl;
201  break;
202  }
203  if ( ! ok_ext )
204  {
205  std::cerr << "[ERROR] p=" << p << " was NOT extendable IN plane=" << plane << std::endl;
206  break;
207  }
208  // else
209  // std::cerr << "[OK] p=" << p << " IN plane=" << plane << std::endl;
210  }
211 
212  // Checks that points outside the naive plane are correctly recognized as outliers.
213  while ( nb != (nbtries * 11 ) / 10 )
214  {
215  p[ 0 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
216  p[ 1 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
217  p[ 2 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
218  x = (Integer) p[ 0 ];
219  y = (Integer) p[ 1 ];
220  z = (Integer) p[ 2 ];
221  switch ( axis ) {
222  case 0: p[ 0 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break;
223  case 1: p[ 1 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break;
224  case 2: p[ 2 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break;
225  }
226  PointInteger tmp = getRandomInteger<PointInteger>( 2, 5 )
227  * (2*getRandomInteger<PointInteger>( 0, 2 ) - 1 );
228  p[ axis ] += tmp;
229  bool ok_ext = ! plane.isExtendable( p ); // should *not* be ok
230  bool ok = ! plane.extend( p ); // should *not* be ok
231  ++nb; nbok += ok ? 1 : 0;
232  ++nb; nbok += ok_ext ? 1 : 0;
233  if ( ! ok )
234  {
235  std::cerr << "[ERROR] p=" << p << " IN plane=" << plane << std::endl;
236  break;
237  }
238  if ( ! ok_ext )
239  {
240  std::cerr << "[ERROR] p=" << p << " was extendable IN plane=" << plane << std::endl;
241  break;
242  }
243  // else
244  // std::cerr << "[OK] p=" << p << " IN plane=" << plane << std::endl;
245  }
246  std::cerr << "plane = " << plane << std::endl;
247  return nb == nbok;
248 }
static Integer abs(IntegerParamType a)

References DGtal::IntegerComputer< TInteger >::abs(), and DGtal::IntegerComputer< TInteger >::ceilDiv().

◆ checkManyPlanes()

template<typename NaivePlaneComputer >
bool checkManyPlanes ( unsigned int  diameter,
unsigned int  nbplanes,
unsigned int  nbpoints 
)

Definition at line 372 of file testCOBANaivePlaneComputer.cpp.

375 {
376  unsigned int nbok = 0;
377  unsigned int nb = 0;
379  stringstream ss (stringstream::out);
380  ss << "Testing block: Diameter is " << diameter << ". Check " << nbplanes << " planes with " << nbpoints << " points each.";
381  trace.beginBlock ( ss.str() );
382  ++nb; nbok += checkPlanes<Integer,NaivePlaneComputer>( nbplanes, diameter, nbpoints ) ? 1 : 0;
383  trace.info() << "(" << nbok << "/" << nb
384  << ") checkPlanes<Integer,NaivePlaneComputer>()"
385  << std::endl;
386  trace.endBlock();
387  return nbok == nb;
388 }

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::info(), and DGtal::trace.

Referenced by main().

◆ checkPlane()

template<typename Integer , typename NaivePlaneComputer >
bool checkPlane ( Integer  a,
Integer  b,
Integer  c,
Integer  d,
int  diameter,
unsigned int  nbtries 
)

Checks the naive plane d <= ax+by+cz <= d + max(|a|,|b|,|c|)-1

Definition at line 61 of file testCOBANaivePlaneComputer.cpp.

63 {
64  typedef typename NaivePlaneComputer::Point Point;
65  typedef typename Point::Component PointInteger;
67  Integer absA = ic.abs( a );
68  Integer absB = ic.abs( b );
69  Integer absC = ic.abs( c );
70  Integer x, y, z;
71  Dimension axis;
72  if ( ( absA >= absB ) && ( absA >= absC ) )
73  axis = 0;
74  else if ( ( absB >= absA ) && ( absB >= absC ) )
75  axis = 1;
76  else
77  axis = 2;
78  Point p;
79  NaivePlaneComputer plane;
80  plane.init( axis, diameter, 1, 1 );
81  // Checks that points within the naive plane are correctly recognized.
82  unsigned int nb = 0;
83  unsigned int nbok = 0;
84  while ( nb != nbtries )
85  {
86  p[ 0 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
87  p[ 1 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
88  p[ 2 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
89  x = (Integer) p[ 0 ];
90  y = (Integer) p[ 1 ];
91  z = (Integer) p[ 2 ];
92  switch ( axis ) {
93  case 0: p[ 0 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break;
94  case 1: p[ 1 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break;
95  case 2: p[ 2 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break;
96  }
97  bool ok_ext = plane.isExtendable( p ); // should be ok
98  bool ok = plane.extend( p ); // should be ok
99  ++nb; nbok += ok_ext ? 1 : 0;
100  ++nb; nbok += ok ? 1 : 0;
101  if ( ! ok )
102  {
103  std::cerr << "[ERROR] p=" << p << " NOT IN plane=" << plane << std::endl;
104  break;
105  }
106  if ( ! ok_ext )
107  {
108  std::cerr << "[ERROR] p=" << p << " was NOT extendable IN plane=" << plane << std::endl;
109  break;
110  }
111  // else
112  // std::cerr << "[OK] p=" << p << " IN plane=" << plane << std::endl;
113  }
114 
115  // Checks that points outside the naive plane are correctly recognized as outliers.
116  while ( nb != (nbtries * 11 ) / 10 )
117  {
118  p[ 0 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
119  p[ 1 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
120  p[ 2 ] = getRandomInteger<PointInteger>( -diameter+1, diameter );
121  x = (Integer) p[ 0 ];
122  y = (Integer) p[ 1 ];
123  z = (Integer) p[ 2 ];
124  switch ( axis ) {
125  case 0: p[ 0 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break;
126  case 1: p[ 1 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break;
127  case 2: p[ 2 ] = NumberTraits<Integer>::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break;
128  }
129  PointInteger tmp = getRandomInteger<PointInteger>( 2, 5 )
130  * (2*getRandomInteger<PointInteger>( 0, 2 ) - 1 );
131  p[ axis ] += tmp;
132  bool ok_ext = ! plane.isExtendable( p ); // should *not* be ok
133  bool ok = ! plane.extend( p ); // should *not* be ok
134  ++nb; nbok += ok ? 1 : 0;
135  ++nb; nbok += ok_ext ? 1 : 0;
136  if ( ! ok )
137  {
138  std::cerr << "[ERROR] p=" << p << " IN plane=" << plane << std::endl;
139  break;
140  }
141  if ( ! ok_ext )
142  {
143  std::cerr << "[ERROR] p=" << p << " was extendable IN plane=" << plane << std::endl;
144  break;
145  }
146  // else
147  // std::cerr << "[OK] p=" << p << " IN plane=" << plane << std::endl;
148  }
149  return nb == nbok;
150 }
void init(Dimension axis, InternalInteger diameter, InternalInteger widthNumerator=NumberTraits< InternalInteger >::ONE, InternalInteger widthDenominator=NumberTraits< InternalInteger >::ONE)
bool isExtendable(const Point &p) const
bool extend(const Point &p)

References DGtal::IntegerComputer< TInteger >::abs(), DGtal::IntegerComputer< TInteger >::ceilDiv(), DGtal::COBANaivePlaneComputer< TSpace, TInternalInteger >::extend(), DGtal::COBANaivePlaneComputer< TSpace, TInternalInteger >::init(), and DGtal::COBANaivePlaneComputer< TSpace, TInternalInteger >::isExtendable().

◆ checkPlanes()

template<typename Integer , typename NaivePlaneComputer >
bool checkPlanes ( unsigned int  nbplanes,
int  diameter,
unsigned int  nbtries 
)

Definition at line 253 of file testCOBANaivePlaneComputer.cpp.

254 {
255  //using namespace Z3i;
256  //typedef COBANaivePlaneComputer<Z3, Integer> NaivePlaneComputer;
257  unsigned int nb = 0;
258  unsigned int nbok = 0;
259  for ( unsigned int nbp = 0; nbp < nbplanes; ++nbp )
260  {
261  Integer a = getRandomInteger<Integer>( (Integer) 0, (Integer) diameter / 2 );
262  Integer b = getRandomInteger<Integer>( (Integer) 0, (Integer) diameter / 2 );
263  Integer c = getRandomInteger<Integer>( (Integer) 0, (Integer) diameter / 2 );
264  Integer d = getRandomInteger<Integer>( (Integer) 0, (Integer) diameter / 2 );
265  if ( ( a != 0 ) || ( b != 0 ) || ( c != 0 ) )
266  {
267  ++nb; nbok += checkPlane<Integer, NaivePlaneComputer>( a, b, c, d, diameter, nbtries ) ? 1 : 0;
268  if ( nb != nbok )
269  {
270  std::cerr << "[ERROR] for plane " << a << " * x + "
271  << b << " * y + " << c << " * z = " << d << std::endl;
272  break;
273  }
274  }
275  }
276  return nb == nbok;
277 }

◆ getRandomInteger()

template<typename Integer >
Integer getRandomInteger ( const Integer first,
const Integer after_last 
)

Definition at line 50 of file testCOBANaivePlaneComputer.cpp.

51 {
52  Integer r = (Integer) rand();
53  return ( r % (after_last - first) ) + first;
54 }

◆ main()

int main ( int  ,
char **   
)

Definition at line 484 of file testCOBANaivePlaneComputer.cpp.

485 {
486  using namespace Z3i;
487 
488  // Max diameter is ~20 for int32_t, ~500 for int64_t, any with BigInteger.
489  trace.beginBlock ( "Testing class COBANaivePlaneComputer" );
490  bool res = true
492  && checkManyPlanes<COBANaivePlaneComputer<Z3, DGtal::int32_t> >( 20, 100, 200 )
494  && checkManyPlanes<COBANaivePlaneComputer<Z3, DGtal::BigInteger> >( 10000, 10, 200 )
496 
497  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
498  trace.endBlock();
499  // trace.beginBlock ( "Max diameter for COBANaivePlaneComputer<Z3, int32_t>" );
500  // unsigned int maxd = maxDiameter<COBANaivePlaneComputer<Z3, DGtal::int32_t> >( 10, 1000 );
501  // trace.emphase() << maxd << endl;
502  // trace.endBlock();
503  // trace.beginBlock ( "Max diameter for COBANaivePlaneComputer<Z3, int64_t>" );
504  // unsigned int maxd2 = maxDiameter<COBANaivePlaneComputer<Z3, DGtal::int32_t> >( 100, 100000 );
505  // trace.emphase() << maxd2 << endl;
506  // trace.endBlock();
507  return res ? 0 : 1;
508 }
Aim: A class that recognizes pieces of digital planes of given axis width. When the width is 1,...
std::ostream & emphase()
bool checkExtendWithManyPoints(unsigned int diameter, unsigned int nbplanes, unsigned int nbpoints)
bool testCOBANaivePlaneComputer()
bool checkManyPlanes(unsigned int diameter, unsigned int nbplanes, unsigned int nbpoints)

References DGtal::Trace::beginBlock(), checkExtendWithManyPoints(), checkManyPlanes(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), testCOBANaivePlaneComputer(), and DGtal::trace.

◆ maxDiameter()

template<typename NaivePlaneComputer >
unsigned int maxDiameter ( unsigned int  min,
unsigned int  max 
)

NB (JOL): Unreliable.

Definition at line 394 of file testCOBANaivePlaneComputer.cpp.

395 {
396  while ( min < max )
397  {
398  unsigned int middle = (min+max)/2;
399  bool ok = checkManyPlanes<NaivePlaneComputer>( middle, 2, 2000 );
400  if ( ok ) min = middle+1;
401  else max = middle;
402  }
403  return min-1;
404 }
int max(int a, int b)

References max().

◆ testCOBANaivePlaneComputer()

bool testCOBANaivePlaneComputer ( )

Example of a test. To be completed.

Definition at line 283 of file testCOBANaivePlaneComputer.cpp.

284 {
285  unsigned int nbok = 0;
286  unsigned int nb = 0;
287  using namespace Z3i;
288  typedef BigInteger Integer;
290  typedef COBAGenericNaivePlaneComputer<Z3, BigInteger> GenericNaivePlaneComputer;
291 
292  BOOST_CONCEPT_ASSERT(( CAdditivePrimitiveComputer< NaivePlaneComputer > ));
294  BOOST_CONCEPT_ASSERT(( boost::ForwardContainer< NaivePlaneComputer > ));
296  BOOST_CONCEPT_ASSERT(( CPointPredicate< NaivePlaneComputer::Primitive > ));
298 
299  trace.beginBlock ( "Testing block: COBANaivePlaneComputer instantiation." );
300  NaivePlaneComputer plane;
301  Point pt0( 0, 0, 0 );
302  plane.init( 2, 100, 3, 2 );
303  bool pt0_inside = plane.extend( pt0 );
304  FATAL_ERROR(pt0_inside);
305 
306  trace.info() << "(" << nbok << "/" << nb << ") Plane=" << plane
307  << std::endl;
308  Point pt1( Point( 8, 1, 3 ) );
309  bool pt1_inside = plane.extend( pt1 );
310  ++nb; nbok += pt1_inside == true ? 1 : 0;
311  trace.info() << "(" << nbok << "/" << nb << ") add " << pt1
312  << " Plane=" << plane << std::endl;
313  Point pt2( Point( 2, 7, 1 ) );
314  bool pt2_inside = plane.extend( pt2 );
315  ++nb; nbok += pt2_inside == true ? 1 : 0;
316  trace.info() << "(" << nbok << "/" << nb << ") add " << pt2
317  << " Plane=" << plane << std::endl;
318 
319  Point pt3( Point( 0, 5, 17 ) );
320  bool pt3_inside = plane.extend( pt3 );
321  ++nb; nbok += pt3_inside == false ? 1 : 0;
322  trace.info() << "(" << nbok << "/" << nb << ") add " << pt3
323  << " Plane=" << plane << std::endl;
324 
325  Point pt4( Point( -10, -10, 10 ) );
326  bool pt4_inside = plane.extend( pt4 );
327  ++nb; nbok += pt4_inside == false ? 1 : 0;
328  trace.info() << "(" << nbok << "/" << nb << ") add " << pt4
329  << " Plane=" << plane << std::endl;
330 
331  Point pt5 = pt0 + pt1 + pt2 + Point( 0, 0, 2 );
332  bool pt5_inside = plane.extend( pt5 );
333  ++nb; nbok += pt5_inside == true ? 1 : 0;
334  trace.info() << "(" << nbok << "/" << nb << ") add " << pt5
335  << " Plane=" << plane << std::endl;
336 
337  NaivePlaneComputer plane2;
338  plane2.init( 2, 100, 1, 1 );
339  plane2.extend( Point( 10, 0, 0 ) );
340  plane2.extend( Point( 0, 8, 0 ) );
341  plane2.extend( Point( 0, 0, 6 ) );
342  trace.info() << "(" << nbok << "/" << nb << ") "
343  << " Plane2=" << plane2 << std::endl;
344 
345  ++nb; nbok += checkPlane<Integer,NaivePlaneComputer>( 11, 5, 19, 20, 100, 100 ) ? 1 : 0;
346  trace.info() << "(" << nbok << "/" << nb
347  << ") checkPlane<Integer,NaivePlaneComputer>( 11, 5, 19, 20, 100, 100 )"
348  << std::endl;
349 
350  ++nb; nbok += checkGenericPlane<Integer,GenericNaivePlaneComputer>( 11, 5, 19, 20, 100, 100 ) ? 1 : 0;
351  trace.info() << "(" << nbok << "/" << nb
352  << ") checkGenericPlane<Integer,GenericNaivePlaneComputer>( 11, 5, 19, 20, 100, 100 )"
353  << std::endl;
354  ++nb; nbok += checkGenericPlane<Integer,GenericNaivePlaneComputer>( 17, 33, 7, 10, 100, 100 ) ? 1 : 0;
355  trace.info() << "(" << nbok << "/" << nb
356  << ") checkGenericPlane<Integer,GenericNaivePlaneComputer>( 17, 33, 7, 10, 100, 100 )"
357  << std::endl;
358  ++nb; nbok += checkPlane<Integer,NaivePlaneComputer>( 15, 8, 13, 15, 100, 100 ) ? 1 : 0;
359  trace.info() << "(" << nbok << "/" << nb
360  << ") checkPlane<Integer,NaivePlaneComputer>( 15, 8, 13, 15, 100, 100 )"
361  << std::endl;
362  ++nb; nbok += checkGenericPlane<Integer,GenericNaivePlaneComputer>( 15, 8, 13, 15, 100, 100 ) ? 1 : 0;
363  trace.info() << "(" << nbok << "/" << nb
364  << ") checkGenericPlane<Integer,GenericNaivePlaneComputer>( 15, 8, 13, 15, 100, 100 )"
365  << std::endl;
366  trace.endBlock();
367  return nbok == nb;
368 }
COBANaivePlaneComputer< Z3, InternalInteger > NaivePlaneComputer
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Definition: BasicTypes.h:79
Aim: Defines the concept describing an object that computes some primitive from input points given gr...
Aim: Defines a predicate on a point.
Go to http://www.sgi.com/tech/stl/ForwardContainer.html.
Definition: Boost.dox:110

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::COBANaivePlaneComputer< TSpace, TInternalInteger >::extend(), DGtal::Trace::info(), DGtal::COBANaivePlaneComputer< TSpace, TInternalInteger >::init(), and DGtal::trace.

Referenced by main().