DGtal  1.4.2
exampleStabbingLineComputer.cpp File Reference

An example file for StabbingLineComputer. More...

#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/geometry/curves/StabbingLineComputer.h"
Include dependency graph for exampleStabbingLineComputer.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

An example file for StabbingLineComputer.

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
Tristan Roussillon (trist.nosp@m.an.r.nosp@m.oussi.nosp@m.llon.nosp@m.@liri.nosp@m.s.cn.nosp@m.rs.fr ) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2011/09/21
See also
testStabbingLineComputer examplePreimage

This file is part of the DGtal library.

Definition in file exampleStabbingLineComputer.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

[StabbingLineComputerUsage]

[StabbingLineComputerUsage]

Definition at line 48 of file exampleStabbingLineComputer.cpp.

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 }
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()
Trace trace
Definition: Common.h:153

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::info(), DGtal::StabbingLineComputer< TConstIterator >::init(), DGtal::GridCurve< TKSpace >::initFromVectorStream(), and DGtal::trace.