DGtal  1.1.0
geometry/curves/exampleArithmeticalDSSComputer.cpp

This example shows the basic usage of a 4-connected standard segment computer, an object devoted to the on-line recognition of 4-connected standard DSSs.

Digital straight lines and segments
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/base/BasicTypes.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
using namespace std;
using namespace DGtal;
int main()
{
using namespace Z2i;
// Container of digital points
typedef std::vector<Z2::Point> Container;
// Iterator on the container
typedef Container::const_iterator ConstIterator;
// StandardDSS4 computer
// Construction of the computer
DSSComputer theDSSComputer;
// Input points
Container contour;
contour.push_back(Z2::Point(0,0));
contour.push_back(Z2::Point(1,0));
contour.push_back(Z2::Point(1,1));
contour.push_back(Z2::Point(2,1));
contour.push_back(Z2::Point(3,1));
contour.push_back(Z2::Point(3,2));
contour.push_back(Z2::Point(4,2));
contour.push_back(Z2::Point(5,2));
contour.push_back(Z2::Point(6,2));
contour.push_back(Z2::Point(6,3));
contour.push_back(Z2::Point(6,4));
// Add points while it is possible
theDSSComputer.init( contour.begin() );
while ( ( theDSSComputer.end() != contour.end() ) &&
( theDSSComputer.extendFront() ) ) {}
// Trace to the standard output
cout << theDSSComputer << endl;
DSSComputer::Primitive theDSS = theDSSComputer.primitive();
// Trace to the standard output
cout << theDSS << endl;
return 1;
}
// //
ConstIterator
MyDigitalSurface::ConstIterator ConstIterator
Definition: greedy-plane-segmentation-ex2.cpp:93
DGtal::ArithmeticalDSSComputer
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Definition: ArithmeticalDSSComputer.h:87
DGtal::ArithmeticalDSSComputer::init
void init(const ConstIterator &it)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
main
int main(int argc, char **argv)
Definition: testArithmeticDSS-benchmark.cpp:147
Point
MyPointD Point
Definition: testClone2.cpp:383