44 #include "DGtal/base/Common.h" 
   45 #include "DGtal/base/Exceptions.h" 
   46 #include "DGtal/kernel/SpaceND.h" 
   47 #include "DGtal/kernel/domains/HyperRectDomain.h" 
   48 #include "DGtal/geometry/curves/ArithmeticalDSS3d.h" 
   49 #include "DGtal/geometry/curves/GreedySegmentation.h" 
   51 using namespace DGtal;
 
   66   typedef std::vector<Point>::iterator Iterator;
 
   69   std::vector<Point> sequence;
 
   70   sequence.push_back(Point(0,0,0));
 
   71   sequence.push_back(Point(1,0,0));
 
   72   sequence.push_back(Point(2,0,0));
 
   73   sequence.push_back(Point(2,1,0));
 
   74   sequence.push_back(Point(2,1,1));
 
   75   sequence.push_back(Point(3,1,1));
 
   76   sequence.push_back(Point(4,1,1));
 
   77   sequence.push_back(Point(4,2,1));
 
   78   sequence.push_back(Point(4,2,2));
 
   79   sequence.push_back(Point(5,2,2));
 
   80   sequence.push_back(Point(6,2,2));
 
   81   sequence.push_back(Point(6,3,2));
 
   82   sequence.push_back(Point(6,3,3));
 
   83   sequence.push_back(Point(6,4,3));
 
   84   sequence.push_back(Point(6,4,4));
 
   85   sequence.push_back(Point(6,5,4));
 
   88   trace.
beginBlock(
"Add points while it is possible and display the result");
 
   91   Iterator i = sequence.begin();  
 
   93   trace.
info() << 
"init with " << (*i) << std::endl;
 
   95     while ( (algo.end() != sequence.end())
 
   96             && algo.extendForward()) {
 
   97       trace.
info() << 
"extended with " << (*(--algo.end())) << std::endl;
 
  101     trace.
info() << algo << 
" " << algo.isValid() << std::endl;
 
  105   return ( algo.isValid() && (algo.end() == (sequence.begin()+13)) );  
 
  114 bool testSegmentation()
 
  118   typedef std::vector<Point>::iterator Iterator;
 
  122   std::vector<Point> sequence;
 
  123   sequence.push_back(Point(0,0,0));
 
  124   sequence.push_back(Point(1,0,0));
 
  125   sequence.push_back(Point(2,0,0));
 
  126   sequence.push_back(Point(2,1,0));
 
  127   sequence.push_back(Point(2,1,1));
 
  128   sequence.push_back(Point(3,1,1));
 
  129   sequence.push_back(Point(4,1,1));
 
  130   sequence.push_back(Point(4,2,1));
 
  131   sequence.push_back(Point(4,2,2));
 
  132   sequence.push_back(Point(5,2,2));
 
  133   sequence.push_back(Point(6,2,2));
 
  134   sequence.push_back(Point(6,3,2));
 
  135   sequence.push_back(Point(6,3,3));
 
  136   sequence.push_back(Point(6,4,3));
 
  137   sequence.push_back(Point(6,4,4));
 
  138   sequence.push_back(Point(6,5,4));
 
  143     SegmentComputer algo;
 
  144     Decomposition theDecomposition(sequence.begin(), sequence.end(), algo);
 
  147     Decomposition::SegmentComputerIterator i = theDecomposition.begin();
 
  148     for ( ; i != theDecomposition.end(); ++i) {
 
  149       SegmentComputer currentSegmentComputer(*i);
 
  150       trace.
info() << currentSegmentComputer << std::endl;  
 
  159 void testArithmeticalDSS3dConceptChecking()
 
  162   typedef std::vector<Point>::const_iterator ConstIterator; 
 
  175 int main(
int argc, 
char **argv)
 
  179   testArithmeticalDSS3dConceptChecking();  
 
  182   for ( 
int i = 0; i < argc; ++i )
 
  186   bool res = testDSSreco() 
 
  187         && testSegmentation()
 
  190   trace.
emphase() << ( res ? 
"Passed." : 
"Error." ) << endl;