DGtal  1.2.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.

See also
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
typedef StandardDSS4Computer<ConstIterator> DSSComputer;
// 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;
}
// //
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
MyPointD Point
Definition: testClone2.cpp:383