DGtal  0.9.3
testParametricShape.cpp
1 
30 #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);
66 
68  Ball2D<Z2i::Space>( cc, 10));
69 
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 // //
void beginBlock(const std::string &keyword="")
const Domain domain(Point(1, 2), Point(6, 5))
Trace trace
Definition: Common.h:137
Vector lower(const Vector &z, unsigned int k)
STL namespace.
double endBlock()
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
Aim: Model of the concept StarShaped represents any circle in the plane.
Definition: Ball2D.h:60
std::ostream & emphase()
int main(int argc, char **argv)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
std::ostream & info()
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
Vector upper(const Vector &z, unsigned int k)
Aim: This class specializes a &#39;Board&#39; class so as to display DGtal objects more naturally (with <<)...
Definition: Board2D.h:70