38#include "DGtal/base/Common.h"
39#include "DGtal/base/Exceptions.h"
40#include "DGtal/kernel/SpaceND.h"
42#include "DGtal/kernel/domains/HyperRectDomain.h"
43#include "DGtal/geometry/curves/FrechetShortcut.h"
44#include "DGtal/io/boards/Board2D.h"
46#include "DGtal/io/boards/CDrawableWithBoard2D.h"
47#include "DGtal/geometry/curves/CForwardSegmentComputer.h"
48#include "DGtal/helpers/StdDefs.h"
50#include "DGtal/geometry/curves/GreedySegmentation.h"
69 unsigned int nbok = 0;
73 typedef std::vector<Point>::iterator Iterator;
76 std::vector<Point> contour;
77 contour.push_back(
Point(0,0));
78 contour.push_back(
Point(1,0));
79 contour.push_back(
Point(2,0));
80 contour.push_back(
Point(3,0));
81 contour.push_back(
Point(4,0));
82 contour.push_back(
Point(5,0));
83 contour.push_back(
Point(6,0));
84 contour.push_back(
Point(7,0));
85 contour.push_back(
Point(7,1));
86 contour.push_back(
Point(6,1));
87 contour.push_back(
Point(5,1));
88 contour.push_back(
Point(4,1));
89 contour.push_back(
Point(3,1));
90 contour.push_back(
Point(2,1));
91 contour.push_back(
Point(3,2));
92 contour.push_back(
Point(4,2));
93 contour.push_back(
Point(5,2));
94 contour.push_back(
Point(6,2));
95 contour.push_back(
Point(7,2));
96 contour.push_back(
Point(8,2));
97 contour.push_back(
Point(9,2));
102 s.init(contour.begin());
106 while ( (s.end() != contour.end())
107 &&(s.extendFront()) ) {}
130 unsigned int nbok = 0;
137 std::vector<Point> contour;
138 contour.push_back(
Point(0,0));
139 contour.push_back(
Point(1,0));
140 contour.push_back(
Point(2,0));
141 contour.push_back(
Point(3,0));
142 contour.push_back(
Point(4,0));
143 contour.push_back(
Point(5,0));
144 contour.push_back(
Point(6,0));
145 contour.push_back(
Point(7,0));
146 contour.push_back(
Point(7,1));
147 contour.push_back(
Point(6,1));
148 contour.push_back(
Point(5,1));
149 contour.push_back(
Point(4,1));
150 contour.push_back(
Point(3,1));
151 contour.push_back(
Point(2,1));
152 contour.push_back(
Point(2,2));
153 contour.push_back(
Point(3,2));
154 contour.push_back(
Point(4,2));
155 contour.push_back(
Point(5,2));
156 contour.push_back(
Point(6,2));
157 contour.push_back(
Point(7,2));
158 contour.push_back(
Point(8,2));
159 contour.push_back(
Point(9,2));
189 for ( ; it != itEnd; ++it) {
197 trace.
info() << theSegmentation << std::endl;
198 board.
saveEPS(
"FrechetShortcutGreedySegmentationTest.eps", Board2D::BoundingBox, 5000 );
219int main(
int argc,
char** argv )
223 for (
int i = 0; i < argc; ++i )
230 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
Aim: On-line computation Computation of the longest shortcut according to the Fréchet distance for a ...
Aim: Computes the greedy segmentation of a range given by a pair of ConstIterators....
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
PointsRange getPointsRange() const
ArrowsRange getArrowsRange() const
Storage::const_iterator ConstIterator
bool initFromVector(const std::vector< Point > &aVectorOfPoints)
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: Specific iterator to visit all the maximal segments of a saturated segmentation.
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
SaturatedSegmentation::SegmentComputerIterator end() const
SaturatedSegmentation::SegmentComputerIterator begin() const
Aim: model of CBidirectionalRangeFromPoint that adapts any range of elements bounded by two iterators...
void beginBlock(const std::string &keyword="")
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: The concept CDrawableWithBoard2D specifies what are the classes that admit an export with Board2...
Aim: Defines the concept describing a forward segment computer. Like any model of CIncrementalSegment...
Struct representing a 2D point.
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
SaturatedSegmentation< SegmentComputer > Segmentation
void testFrechetShortcutConceptChecking()
bool testFrechetShortcut()