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>
53#include "DGtal/geometry/curves/SegmentComputerUtils.h"
56#define PRECISION 0.00000001
109 template <typename TIterator,typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
303 Cone(
double x,
double y,
double x0,
double y0,
double x1,
double y1);
365 static bool isBetween(
double i,
double a,
double b,
double n)
368 return (i>=a && i<=b);
370 return ((i>=a && i<=n) || (i>=0 && i<=b));
401 double x1,
double y1,
double r1,
402 double *xi,
double *yi,
403 double *xi_prime,
double *yi_prime)
412 *xi_prime = x0 ; *yi_prime = y0;
419 *xi_prime = x1 ; *yi_prime = y1;
423 double a, dx, dy, d, h, rx, ry;
436 if((r0+r1)*(r0+r1)-((dy*dy)+(dx*dx)) < PRECISION)
443 *xi_prime = *xi; *yi_prime = *yi;
451 std::cerr <<
"Warning : the two circles do not intersect -> should never happen" << std::endl;
454 if (d < fabs(r0 - r1))
467 a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ;
470 x2 = x0 + (dx * a/d);
471 y2 = y0 + (dy * a/d);
477 h = sqrt((r0*r0) - (a*a));
515 static int circleTangentPoints(
double x,
double y,
double x1,
double y1,
double r1,
double *xi,
double *yi,
516 double *xi_prime,
double *yi_prime)
518 double x0 = (x+x1)/2;
519 double y0 = (y+y1)/2;
520 double r0 = sqrt((x-x1)*(x-x1) + (y-y1)*(y-y1))/2;
553 return atan(alpha)+2*M_PI;
556 return atan(alpha)+M_PI;
581 return acos((
double)ic.
dotProduct(u,v)/(u.norm()*v.norm()));
679 static int rot(
int d,
int quad)
967 template <
typename TIterator,
typename TInteger>
981#include "DGtal/geometry/curves/FrechetShortcut.ih"
987#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)
FrechetShortcut< std::reverse_iterator< ConstIterator >, Integer > Reverse
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
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...