DGtal  1.5.beta
testArithDSSIterator.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/geometry/curves/ArithDSSIterator.h"
#include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
Include dependency graph for testArithDSSIterator.cpp:

Go to the source code of this file.

Functions

bool testArithDSSIterator ()
 
int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Isabelle Sivignon (isabe.nosp@m.lle..nosp@m.sivig.nosp@m.non@.nosp@m.gipsa.nosp@m.-lab.nosp@m..gren.nosp@m.oble.nosp@m.-inp..nosp@m.fr ) gipsa-lab Grenoble Images Parole Signal Automatique (CNRS, UMR 5216), CNRS, France
Date
2012/11/26

Functions for testing class ArithDSSIterator.

This file is part of the DGtal library.

Definition in file testArithDSSIterator.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 74 of file testArithDSSIterator.cpp.

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 }
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
Trace trace
Definition: Common.h:153
bool testArithDSSIterator()

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), testArithDSSIterator(), and DGtal::trace.

◆ testArithDSSIterator()

bool testArithDSSIterator ( )

Example of a test. To be completed.

Definition at line 47 of file testArithDSSIterator.cpp.

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 }
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
MyPointD Point
Definition: testClone2.cpp:383

Referenced by main().