DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
testParametricShape.cpp
1 
30 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/shapes/Shapes.h"
35 #include "DGtal/shapes/parametric/Ball2D.h"
36 #include "DGtal/io/boards/Board2D.h"
37 #include "DGtal/io/colormaps/GrayscaleColorMap.h"
38 #include "DGtal/images/ImageContainerBySTLVector.h"
40 
41 using namespace std;
42 using namespace DGtal;
43 
45 // Functions for testing class ParametricShape.
47 
51 bool testParametricShape()
52 {
53  unsigned int nbok = 0;
54  unsigned int nb = 0;
55 
56  trace.beginBlock ( "Testing parametric shaper ..." );
57  Z2i::Point a(0,0);
58  Z2i::Point b(64,64);
59  Z2i::Space::RealPoint c(32.0,32.0);
60  Z2i::Point cc(32,32);
61 
62  Board2D board;
63 
64  Z2i::Domain domain(a,b);
65  Z2i::DigitalSet set(domain);
66 
68  Ball2D<Z2i::Space>( cc, 10));
69 
70  Z2i::Point lower,upper;
71  set.computeBoundingBox(lower,upper);
72 
73  trace.info()<<"Generated set: "<<set<<" lowerBound="<<lower
74  <<" upperBound="<<upper<<std::endl;
75 
76  board << set;
77  board.saveSVG("parametricball.svg");
78 
79  nbok += true ? 1 : 0;
80  nb++;
81  trace.info() << "(" << nbok << "/" << nb << ") "
82  << "true == true" << std::endl;
83  trace.endBlock();
84 
85  return nbok == nb;
86 }
87 
89 // Standard services - public :
90 
91 int main( int argc, char** argv )
92 {
93  trace.beginBlock ( "Testing class ImplicitShape" );
94  trace.info() << "Args:";
95  for ( int i = 0; i < argc; ++i )
96  trace.info() << " " << argv[ i ];
97  trace.info() << endl;
98 
99  bool res = testParametricShape(); // && ... other tests
100  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
101  trace.endBlock();
102  return res ? 0 : 1;
103 }
104 // //