DGtal  1.3.beta
testArithDSSIterator.cpp
Go to the documentation of this file.
1 
30 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "DGtal/geometry/curves/ArithDSSIterator.h"
34 #include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
36 
37 using namespace std;
38 using namespace DGtal;
39 
41 // Functions for testing class ArithDSSIterator.
43 
48 {
49  typedef PointVector<2,int> Point;
50  typedef ArithDSSIterator<int,8> MyIterator;
51 
52  Point p(3,2);
53  MyIterator it(2,5,-4,p);
54 
55  typedef NaiveDSS8<int> ArithDSS;
56 
57  ArithDSS myDSS(p, p);
58 
59  int absMax=8;
60 
61  while ( (*it)[0] <=absMax && myDSS.extendFront(*++it))
62  {}
63 
64  std::cout << myDSS.a() << " " << myDSS.b() << " " << myDSS.mu() << " " << std::endl;
65 
66  return ( (myDSS.a() == 2) &&
67  (myDSS.b() == 5) &&
68  (myDSS.mu() == -4) );
69 }
70 
72 // Standard services - public :
73 
74 int main( int argc, char** argv )
75 {
76  trace.beginBlock ( "Testing class ArithDSSIterator" );
77  trace.info() << "Args:";
78  for ( int i = 0; i < argc; ++i )
79  trace.info() << " " << argv[ i ];
80  trace.info() << endl;
81 
82  bool res = testArithDSSIterator(); // && ... other tests
83  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
84  trace.endBlock();
85  return res ? 0 : 1;
86 }
87 // //
main
int main(int argc, char **argv)
Definition: testArithDSSIterator.cpp:74
DGtal::Trace::endBlock
double endBlock()
testArithDSSIterator
bool testArithDSSIterator()
Definition: testArithDSSIterator.cpp:47
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::trace
Trace trace
Definition: Common.h:154
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::ArithDSSIterator
Aim: An iterator on the points of a Digital Straight Segment. Template parameters are the integer typ...
Definition: ArithDSSIterator.h:63
DGtal::NaiveDSS8
Aim: This class represents a standard digital straight segment (DSS), ie. the sequence of simply 8-co...
Definition: ArithmeticalDSS.h:968
DGtal::Trace::info
std::ostream & info()
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
Point
MyPointD Point
Definition: testClone2.cpp:383