DGtal  1.5.beta
testArithDSSIterator.cpp
Go to the documentation of this file.
1 
31 #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 // //
Aim: An iterator on the points of a Digital Straight Segment. Template parameters are the integer typ...
Aim: This class represents a standard digital straight segment (DSS), ie. the sequence of simply 8-co...
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
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 testArithDSSIterator()
MyPointD Point
Definition: testClone2.cpp:383