DGtal  0.9.2
exampleStabbingCircleComputer.cpp
1 
31 #include <iostream>
33 
34 #include "DGtal/base/Common.h"
35 #include "DGtal/helpers/StdDefs.h"
36 #include "ConfigExamples.h"
37 
38 #include "DGtal/geometry/curves/StabbingCircleComputer.h"
39 
41 
42 using namespace std;
43 using namespace DGtal;
44 using namespace Z2i;
45 
46 
48 int main( int argc, char** argv )
49 {
50  trace.beginBlock ( "Example for StabbingCircleComputer" );
51  trace.info() << "Args:";
52  for ( int i = 0; i < argc; ++i )
53  trace.info() << " " << argv[ i ];
54  trace.info() << endl;
55 
56  std::string filename = examplesPath + "samples/DCA.dat";
57  ifstream instream; // input stream
58  instream.open (filename.c_str(), ifstream::in);
59 
60  Curve c; //grid curve
61  c.initFromVectorStream(instream);
62 
63 
64  trace.beginBlock("Simple example");
65 
67  Curve::IncidentPointsRange r = c.getIncidentPointsRange();
68  Curve::IncidentPointsRange::ConstIterator itEnd (r.end());
69 
71  //extension
72  s.init( r.begin() );
73  while ( ( s.end() != itEnd )
74  &&( s.extendFront() ) ) {}
76 
77  trace.info() << s << endl;
78 
79  trace.endBlock();
80 
81 
82  return 0;
83 }
84 // //
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:130
GridCurve< K2 > Curve
Definition: StdDefs.h:116
STL namespace.
double endBlock()
Aim: On-line recognition of a digital circular arcs (DCA) defined as a sequence of connected grid edg...
void init(const ConstIterator &anIt)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & info()