DGtal  1.2.0
testParametricShape.cpp
1 
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  trace.beginBlock ( "Testing parametric shaper ..." );
54  Z2i::Point a(0,0);
55  Z2i::Point b(64,64);
56  Z2i::Space::RealPoint c(32.0,32.0);
57  Z2i::Point cc(32,32);
58 
59  Board2D board;
60 
61  Z2i::Domain domain(a,b);
63 
65  Ball2D<Z2i::Space>( cc, 10));
66 
68  set.computeBoundingBox(lower,upper);
69 
70  trace.info()<<"Generated set: "<<set<<" lowerBound="<<lower
71  <<" upperBound="<<upper<<std::endl;
72 
73  board << set;
74  board.saveSVG("parametricball.svg");
75 
76  return true;
77 }
78 
80 // Standard services - public :
81 
82 int main( int argc, char** argv )
83 {
84  trace.beginBlock ( "Testing class ImplicitShape" );
85  trace.info() << "Args:";
86  for ( int i = 0; i < argc; ++i )
87  trace.info() << " " << argv[ i ];
88  trace.info() << endl;
89 
90  bool res = testParametricShape(); // && ... other tests
91  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
92  trace.endBlock();
93  return res ? 0 : 1;
94 }
95 // //
Aim: Model of the concept StarShaped represents any circle in the plane.
Definition: Ball2D.h:61
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:71
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:154
int main(int argc, char **argv)
Domain domain
Vector lower(const Vector &z, unsigned int k)
Vector upper(const Vector &z, unsigned int k)