32#if defined(FrechetShortcut_RECURSES)
33#error Recursive header files inclusion detected in FrechetShortcut.h
36#define FrechetShortcut_RECURSES
38#if !defined FrechetShortcut_h
40#define FrechetShortcut_h
44#include "DGtal/base/Common.h"
45#include "DGtal/base/ConceptUtils.h"
46#include "DGtal/kernel/PointVector.h"
47#include "DGtal/arithmetic/IntegerComputer.h"
48#include <boost/icl/interval_set.hpp>
49#include <boost/iterator/reverse_iterator.hpp>
54#include "DGtal/geometry/curves/SegmentComputerUtils.h"
57#define PRECISION 0.00000001
110 template <typename TIterator,typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
304 Cone(
double x,
double y,
double x0,
double y0,
double x1,
double y1);
366 static bool isBetween(
double i,
double a,
double b,
double n)
369 return (i>=a && i<=b);
371 return ((i>=a && i<=n) || (i>=0 && i<=b));
366 static bool isBetween(
double i,
double a,
double b,
double n) {
…}
402 double x1,
double y1,
double r1,
403 double *xi,
double *yi,
404 double *xi_prime,
double *yi_prime)
413 *xi_prime = x0 ; *yi_prime = y0;
420 *xi_prime = x1 ; *yi_prime = y1;
424 double a, dx, dy, d, h, rx, ry;
437 if((r0+r1)*(r0+r1)-((dy*dy)+(dx*dx)) < PRECISION)
444 *xi_prime = *xi; *yi_prime = *yi;
452 std::cerr <<
"Warning : the two circles do not intersect -> should never happen" << std::endl;
455 if (d < fabs(r0 - r1))
468 a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ;
471 x2 = x0 + (dx * a/d);
472 y2 = y0 + (dy * a/d);
478 h = sqrt((r0*r0) - (a*a));
516 static int circleTangentPoints(
double x,
double y,
double x1,
double y1,
double r1,
double *xi,
double *yi,
517 double *xi_prime,
double *yi_prime)
519 double x0 = (x+x1)/2;
520 double y0 = (y+y1)/2;
521 double r0 = sqrt((x-x1)*(x-x1) + (y-y1)*(y-y1))/2;
516 static int circleTangentPoints(
double x,
double y,
double x1,
double y1,
double r1,
double *xi,
double *yi, {
…}
554 return atan(alpha)+2*M_PI;
557 return atan(alpha)+M_PI;
582 return acos((
double)ic.
dotProduct(u,v)/(u.norm()*v.norm()));
680 static int rot(
int d,
int quad)
680 static int rot(
int d,
int quad) {
…}
968 template <
typename TIterator,
typename TInteger>
982#include "DGtal/geometry/curves/FrechetShortcut.ih"
988#undef FrechetShortcut_RECURSES
const FrechetShortcut< ConstIterator, Integer > * myS
struct DGtal::FrechetShortcut::Backpath::occulter_attributes occulter_attributes
boost::icl::interval_set< double > IntervalSet
void updateBackPathFirstQuad(int d, const ConstIterator &)
std::map< ConstIterator, occulter_attributes > occulter_list
Backpath & operator=(const Backpath &other)
IntervalSet myForbiddenIntervals
Backpath(const Backpath &other)
Backpath(const FrechetShortcut< ConstIterator, Integer > *s, int q)
occulter_list myOcculters
void intersectCones(Cone c)
Cone & operator=(const Cone &c)
void selfDisplay(std::ostream &out) const
Cone(const Cone &c)=default
Cone(double a0, double a1)
Cone intersectConesSimple(Cone c)
Cone(double x, double y, double x0, double y0, double x1, double y1)
Aim: On-line computation Computation of the longest shortcut according to the Fréchet distance for a ...
std::string className() const
FrechetShortcut & operator=(const Self &other)
ConstIterator begin() const
IteratorCirculatorTraits< ConstIterator >::Value Point
bool operator!=(const Self &other) const
Vector::Coordinate Coordinate
Reverse getReverse() const
IteratorCirculatorTraits< ConstIterator >::Value Vector
FrechetShortcut(const Self &other)
void selfDisplay(std::ostream &out) const
void init(const ConstIterator &it)
FrechetShortcut(double error)
FrechetShortcut getSelf()
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
bool operator==(const Self &other) const
FrechetShortcut< boost::reverse_iterator< ConstIterator >, Integer > Reverse
ConstIterator end() const
std::vector< Backpath > myBackpath
FrechetShortcut< ConstIterator, Integer > Self
bool testUpdateBackpath()
Aim: This class gathers several types and methods to make computation with integers.
Integer dotProduct(const Vector2I &u, const Vector2I &v) const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...