DGtal 1.3.0
Loading...
Searching...
No Matches
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
// 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;
}
// //
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
void init(const ConstIterator &it)
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
int main()
Definition: testBits.cpp:56