DGtal  1.4.beta
exampleStabbingLineComputer.cpp
Go to the documentation of this file.
1 
32 #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/StabbingLineComputer.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 StabbingLineComputer" );
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/DSS.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();
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 // //
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Definition: GridCurve.h:173
bool initFromVectorStream(std::istream &in)
Storage::const_iterator ConstIterator
Definition: GridCurve.h:314
Aim: On-line recognition of a digital straight segment (DSS) defined as a sequence of connected grid ...
void init(const ConstIterator &anIt)
void beginBlock(const std::string &keyword="")
std::ostream & info()
double endBlock()
int main(int argc, char **argv)
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:153