DGtal
0.6.devel
|
#include <FrechetShortcut.h>
Data Structures | |
class | Backpath |
class | Cone |
struct | Tools |
Public Types | |
typedef TInteger | Integer |
typedef TIterator | ConstIterator |
typedef FrechetShortcut < ConstIterator, Integer > | Self |
typedef FrechetShortcut < std::reverse_iterator < ConstIterator >, Integer > | Reverse |
typedef IteratorCirculatorTraits < ConstIterator >::Value | Point |
typedef IteratorCirculatorTraits < ConstIterator >::Value | Vector |
typedef Vector::Coordinate | Coordinate |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((CInteger< TInteger >)) | |
FrechetShortcut () | |
FrechetShortcut (double error) | |
void | init (const ConstIterator &it) |
FrechetShortcut | getSelf () |
FrechetShortcut (const Self &other) | |
FrechetShortcut & | operator= (const Self &other) |
Reverse | getReverse () const |
bool | operator== (const Self &other) const |
bool | operator!= (const Self &other) const |
~FrechetShortcut () | |
bool | isExtendableForward () |
bool | extendForward () |
ConstIterator | begin () const |
ConstIterator | end () const |
std::string | className () const |
bool | isValid () const |
bool | updateBackpath () |
bool | testUpdateBackpath () |
bool | isBackpathOk () |
void | resetBackpath () |
void | resetCone () |
bool | testUpdateWidth () |
Cone | computeNewCone () |
bool | updateWidth () |
void | selfDisplay (std::ostream &out) const |
Protected Attributes | |
double | myError |
std::vector< Backpath > | myBackpath |
Cone | myCone |
ConstIterator | myBegin |
ConstIterator | myEnd |
Aim: On-line computation Computation of the longest shortcut according to the Fréchet distance for a given error. See related article: Sivignon, I., (2011). A Near-Linear Time Guaranteed Algorithm for Digital Curve Simplification under the Fréchet Distance. DGCI 2011. Retrieved from http://link.springer.com/chapter/10.1007/978-3-642-19867-0_28.
Description of class 'FrechetShortcut' <p>
The algorithm we propose uses an approximation of the Fréchet distance, but a guarantee over the quality of the simplification is proved. Moreover, even if the theoretical complexity of the algorithm is in \( O(n log(n)) \), experiments show a linear behaviour in practice.
We denote by \( error(i,j) \) the Fréchet distance between the segment \([p_ip_j]\) and the part of the curve between the points \(p_i\) and \(p_j\). The approximation of the Fréchet distance is based on the fact that \( error(i,j) \) can be upper and lower bounded by a function of two values, namely \( w(i,j)$ \) and \( b(i,j) \), where \( w(i,j)$ \) is the width of the points between \(p_i\) and \(p_j\) in the direction \( p_ip_j \) and \( b(i,j) \) is the length of the longest backpath in this direction.
Then, the algorithm consists in greedily reading the points of the curves from a first point given by myBegin, while updating the values \( w(i,j) \) and \( b(i,j) \) on the fly.
This class is a model of the concept CForwardSegmentComputer It should be used with the Curve object (defined in StdDefs.h) and
*its PointsRange as follows:
TIterator | Iterator type on 2D digital points, TInteger type *of integer |
Definition at line 107 of file FrechetShortcut.h.
typedef TIterator DGtal::FrechetShortcut< TIterator, TInteger >::ConstIterator |
Definition at line 120 of file FrechetShortcut.h.
typedef Vector::Coordinate DGtal::FrechetShortcut< TIterator, TInteger >::Coordinate |
Definition at line 127 of file FrechetShortcut.h.
typedef TInteger DGtal::FrechetShortcut< TIterator, TInteger >::Integer |
Definition at line 115 of file FrechetShortcut.h.
typedef IteratorCirculatorTraits<ConstIterator>::Value DGtal::FrechetShortcut< TIterator, TInteger >::Point |
Definition at line 125 of file FrechetShortcut.h.
typedef FrechetShortcut<std::reverse_iterator<ConstIterator>,Integer> DGtal::FrechetShortcut< TIterator, TInteger >::Reverse |
Definition at line 122 of file FrechetShortcut.h.
typedef FrechetShortcut<ConstIterator,Integer> DGtal::FrechetShortcut< TIterator, TInteger >::Self |
Definition at line 121 of file FrechetShortcut.h.
typedef IteratorCirculatorTraits<ConstIterator>::Value DGtal::FrechetShortcut< TIterator, TInteger >::Vector |
Definition at line 126 of file FrechetShortcut.h.
|
inline |
Default constructor. not valid
FrechetShortcut class
Definition at line 534 of file FrechetShortcut.ih.
References DGtal::FrechetShortcut< TIterator, TInteger >::myBackpath, DGtal::FrechetShortcut< TIterator, TInteger >::myCone, and DGtal::FrechetShortcut< TIterator, TInteger >::myError.
Referenced by DGtal::FrechetShortcut< TIterator, TInteger >::getSelf().
|
inline |
Constructor with initialisation
it | an iterator on 2D points |
Definition at line 551 of file FrechetShortcut.ih.
References DGtal::FrechetShortcut< TIterator, TInteger >::myBackpath, DGtal::FrechetShortcut< TIterator, TInteger >::myCone, and DGtal::FrechetShortcut< TIterator, TInteger >::myError.
DGtal::FrechetShortcut< TIterator, TInteger >::FrechetShortcut | ( | const Self & | other | ) |
Copy constructor.
other | the object to clone. |
|
inline |
|
inline |
Definition at line 866 of file FrechetShortcut.ih.
Referenced by DGtal::Display2DFactory::draw().
DGtal::FrechetShortcut< TIterator, TInteger >::BOOST_CONCEPT_ASSERT | ( | (CInteger< TInteger >) | ) |
|
inline |
Definition at line 883 of file FrechetShortcut.ih.
|
inline |
Computes the cone defined by the point *myBegin and the new point *myEnd + 1 and intersect it with myCone (unchanged)
Definition at line 665 of file FrechetShortcut.ih.
References DGtal::FrechetShortcut< TIterator, TInteger >::Cone::intersectCones(), M_PI, and M_PI_2.
|
inline |
Definition at line 873 of file FrechetShortcut.ih.
Referenced by DGtal::Display2DFactory::draw().
|
inline |
Tests whether the FrechetShortcut can be extended at the front. Extend the FrechetShortcut if yes.
Definition at line 642 of file FrechetShortcut.ih.
|
inline |
Definition at line 615 of file FrechetShortcut.ih.
|
inline |
Definition at line 580 of file FrechetShortcut.ih.
References DGtal::FrechetShortcut< TIterator, TInteger >::FrechetShortcut(), and DGtal::FrechetShortcut< TIterator, TInteger >::myError.
|
inline |
Initialisation.
it | an iterator on 2D points |
Definition at line 569 of file FrechetShortcut.ih.
References DGtal::FrechetShortcut< TIterator, TInteger >::myBegin, DGtal::FrechetShortcut< TIterator, TInteger >::myEnd, DGtal::FrechetShortcut< TIterator, TInteger >::resetBackpath(), and DGtal::FrechetShortcut< TIterator, TInteger >::resetCone().
|
inline |
Test if there exist a backpath of length greater than the threshold
Definition at line 808 of file FrechetShortcut.ih.
|
inline |
Tests whether the FrechetShortcut can be extended at the front.
Definition at line 656 of file FrechetShortcut.ih.
bool DGtal::FrechetShortcut< TIterator, TInteger >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
|
inline |
Difference operator.
other | the object to compare with. |
Definition at line 633 of file FrechetShortcut.ih.
|
inline |
Assignment.
other | the object to copy. |
Definition at line 597 of file FrechetShortcut.ih.
References DGtal::FrechetShortcut< TIterator, TInteger >::myBackpath, DGtal::FrechetShortcut< TIterator, TInteger >::myBegin, DGtal::FrechetShortcut< TIterator, TInteger >::myCone, DGtal::FrechetShortcut< TIterator, TInteger >::myEnd, and DGtal::FrechetShortcut< TIterator, TInteger >::myError.
|
inline |
Equality operator.
other | the object to compare with. |
Definition at line 623 of file FrechetShortcut.ih.
References DGtal::FrechetShortcut< TIterator, TInteger >::myBegin, DGtal::FrechetShortcut< TIterator, TInteger >::myEnd, and DGtal::FrechetShortcut< TIterator, TInteger >::myError.
|
inline |
Reset the backpaths before the computation of a new shortcut
Definition at line 845 of file FrechetShortcut.ih.
Referenced by DGtal::FrechetShortcut< TIterator, TInteger >::init().
|
inline |
Reset the cone before the computation of a new shortcut
Definition at line 855 of file FrechetShortcut.ih.
Referenced by DGtal::FrechetShortcut< TIterator, TInteger >::init().
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 898 of file FrechetShortcut.ih.
|
inline |
Test if there exist a backpath of length greater than the threshold after the addition of the point pointed by *myEnd+1, but does not modify myBackpath.
Definition at line 735 of file FrechetShortcut.ih.
|
inline |
Test if the new direction belongs to the new cone, but does not modify myCone
Definition at line 711 of file FrechetShortcut.ih.
References DGtal::FrechetShortcut< TIterator, TInteger >::Cone::isEmpty(), M_PI, DGtal::FrechetShortcut< TIterator, TInteger >::Cone::myInf, DGtal::FrechetShortcut< TIterator, TInteger >::Cone::myMax, and DGtal::FrechetShortcut< TIterator, TInteger >::Cone::myMin.
|
inline |
Updates the backpaths (one per octant) according to the new point
Definition at line 791 of file FrechetShortcut.ih.
|
inline |
Updates the width according to the new point
Definition at line 761 of file FrechetShortcut.ih.
References DGtal::FrechetShortcut< TIterator, TInteger >::Cone::isEmpty(), M_PI, DGtal::FrechetShortcut< TIterator, TInteger >::Cone::myInf, DGtal::FrechetShortcut< TIterator, TInteger >::Cone::myMax, and DGtal::FrechetShortcut< TIterator, TInteger >::Cone::myMin.
|
protected |
Vector of 8 backpaths, one per octant. Stores all the information needed to update the length of the longest backpath.
Definition at line 805 of file FrechetShortcut.h.
Referenced by DGtal::FrechetShortcut< TIterator, TInteger >::FrechetShortcut(), and DGtal::FrechetShortcut< TIterator, TInteger >::operator=().
|
protected |
ConstIterator pointing to the back of the shortcut
Definition at line 815 of file FrechetShortcut.h.
Referenced by DGtal::FrechetShortcut< TIterator, TInteger >::init(), DGtal::FrechetShortcut< TIterator, TInteger >::operator=(), and DGtal::FrechetShortcut< TIterator, TInteger >::operator==().
|
protected |
Cone used to update the width
Definition at line 810 of file FrechetShortcut.h.
Referenced by DGtal::FrechetShortcut< TIterator, TInteger >::FrechetShortcut(), and DGtal::FrechetShortcut< TIterator, TInteger >::operator=().
|
protected |
ConstIterator pointing to the front of the shortcut
Definition at line 819 of file FrechetShortcut.h.
Referenced by DGtal::FrechetShortcut< TIterator, TInteger >::init(), DGtal::FrechetShortcut< TIterator, TInteger >::operator=(), and DGtal::FrechetShortcut< TIterator, TInteger >::operator==().
|
protected |
Error parameter used to compute the shortcut
Definition at line 799 of file FrechetShortcut.h.
Referenced by DGtal::FrechetShortcut< TIterator, TInteger >::FrechetShortcut(), DGtal::FrechetShortcut< TIterator, TInteger >::getSelf(), DGtal::FrechetShortcut< TIterator, TInteger >::operator=(), and DGtal::FrechetShortcut< TIterator, TInteger >::operator==().