DGtal  1.3.beta
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  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 // //
DGtal::HyperRectDomain< Space >
DGtal::Trace::endBlock
double endBlock()
lower
Vector lower(const Vector &z, unsigned int k)
Definition: viewDualSurface.cpp:190
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::trace
Trace trace
Definition: Common.h:154
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Ball2D
Aim: Model of the concept StarShaped represents any circle in the plane.
Definition: Ball2D.h:60
DGtal::Trace::info
std::ostream & info()
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
LibBoard::Board::saveSVG
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
main
int main(int argc, char **argv)
Definition: testArithmeticDSS-benchmark.cpp:147
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70
DGtal::Shapes
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
Definition: DGtal/shapes/Shapes.h:71
upper
Vector upper(const Vector &z, unsigned int k)
Definition: viewDualSurface.cpp:197
domain
Domain domain
Definition: testProjection.cpp:88
DGtal::PointVector< dim, Integer >
DGtal::DigitalSetByAssociativeContainer
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Definition: DigitalSetByAssociativeContainer.h:89