DGtal  1.5.beta
testMeasureSet.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/ShapeFactory.h"
36 
37 #include "DGtal/geometry/volumes/estimation/Measure.h"
38 
40 
41 using namespace std;
42 using namespace DGtal;
43 
45 // Functions for testing class Measure.
47 
48 bool testConcept()
49 {
50 
51  return true;
52 }
53 
54 
55 
60 bool testMeasure()
61 {
62  trace.beginBlock ( "Testing Measure ..." );
63 
64 
65  Z3i::Point a(0,0);
66  Z3i::Point b(64,64,64);
67  Z3i::Point c(32,32,32);
68  Z3i::Domain domain(a,b);
70 
72  ImplicitBall<Z3i::Space>( c, 10));
73 
75 
76  trace.info() << "Input set= "<<set<<std::endl;
77 
78  trace.info()<<measure<<std::endl;
79 
80 
81  measure.init(10, set);
82  trace.info() << "Volume (h=10) "<<measure.eval()<<std::endl;
83  measure.init(100, set);
84  trace.info() << "Volume (h=100) "<<measure.eval()<<std::endl;
85 
86  trace.info()<<measure<<std::endl;
87 
88  trace.endBlock();
89 
90  return true;
91 }
92 
94 // Standard services - public :
95 
96 int main( int argc, char** argv )
97 {
98  trace.beginBlock ( "Testing class Measure" );
99  trace.info() << "Args:";
100  for ( int i = 0; i < argc; ++i )
101  trace.info() << " " << argv[ i ];
102  trace.info() << endl;
103 
104  bool res = testConcept() && testMeasure(); // && ... other tests
105  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
106  trace.endBlock();
107  return res ? 0 : 1;
108 }
109 // //
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Definition: ImplicitBall.h:65
Aim: Implements a simple measure computation (in the Lesbegue sens) of a set. In dimension 2,...
Definition: Measure.h:72
Quantity eval() const
void init(const double h, const Set &aSetPointer)
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()
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:153
int main(int argc, char **argv)
bool testConcept()
Domain domain