#include <DGtal/geometry/curves/FrechetShortcut.h>
|
static bool | isBetween (double i, double a, double b, double n) |
|
static int | circle_circle_intersection (double x0, double y0, double r0, double x1, double y1, double r1, double *xi, double *yi, double *xi_prime, double *yi_prime) |
|
static int | circleTangentPoints (double x, double y, double x1, double y1, double r1, double *xi, double *yi, double *xi_prime, double *yi_prime) |
|
static double | computeAngle (double x0, double y0, double x1, double y1) |
|
static double | angleVectVect (Vector u, Vector v) |
|
static int | computeChainCode (Point p, Point q) |
|
static int | computeOctant (Point p, Point q) |
|
static int | rot (int d, int quad) |
|
static Vector | chainCode2Vect (int d) |
|
template<typename TIterator, typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
struct DGtal::FrechetShortcut< TIterator, TInteger >::Tools
Definition at line 354 of file FrechetShortcut.h.
◆ angleVectVect()
template<typename TIterator , typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
◆ chainCode2Vect()
template<typename TIterator , typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
Converts a chain code into a vector
- Parameters
-
- Returns
- a vector
Definition at line 689 of file FrechetShortcut.h.
DigitalPlane::Point Vector
◆ circle_circle_intersection()
template<typename TIterator , typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
static int DGtal::FrechetShortcut< TIterator, TInteger >::Tools::circle_circle_intersection |
( |
double |
x0, |
|
|
double |
y0, |
|
|
double |
r0, |
|
|
double |
x1, |
|
|
double |
y1, |
|
|
double |
r1, |
|
|
double * |
xi, |
|
|
double * |
yi, |
|
|
double * |
xi_prime, |
|
|
double * |
yi_prime |
|
) |
| |
|
inlinestatic |
Determine the points where two circles in a common plane intersect Parameters: three doubles per circle (center, radius), pointers to the two intersection points
- Returns
- 0 if the circles do not intersect each other, 1 otherwise
Definition at line 400 of file FrechetShortcut.h.
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));
Referenced by DGtal::FrechetShortcut< TIterator, TInteger >::Tools::circleTangentPoints().
◆ circleTangentPoints()
template<typename TIterator , typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
static int DGtal::FrechetShortcut< TIterator, TInteger >::Tools::circleTangentPoints |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
x1, |
|
|
double |
y1, |
|
|
double |
r1, |
|
|
double * |
xi, |
|
|
double * |
yi, |
|
|
double * |
xi_prime, |
|
|
double * |
yi_prime |
|
) |
| |
|
inlinestatic |
Given a point X and a circle of center X1, compute the two points Xi and Xi' of the circle the tangent of which go through X. Since the triangle XXiX1 is a right triangle on Xi, the middle point M between X and X1 is equidistant to X, X1 and Xi. Thus, Xi belongs to the intersection of the circle (X1,r1) and the circle of center M and radius ||XX1||/2.
- Parameters
-
[in] | x | the first coordinate of X. |
[in] | y | the second coordinate of X. |
[in] | x1 | the first coordinate of the circle center X1. |
[in] | y1 | the second coordinate of the circle center X1. |
[in] | r1 | the circle radius. |
[out] | xi | pointer to the first coordinate of the first intersection point. |
[out] | yi | pointer to the second coordinate of the first intersection point. |
[out] | xi_prime | pointer to the first coordinate of the second intersection point. |
[out] | yi_prime | pointer to the second coordinate of the second intersection point. |
- Returns
- result of the call to circle_circle_intersection
Definition at line 515 of file FrechetShortcut.h.
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;
References DGtal::FrechetShortcut< TIterator, TInteger >::Tools::circle_circle_intersection().
◆ computeAngle()
template<typename TIterator , typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
static double DGtal::FrechetShortcut< TIterator, TInteger >::Tools::computeAngle |
( |
double |
x0, |
|
|
double |
y0, |
|
|
double |
x1, |
|
|
double |
y1 |
|
) |
| |
|
inlinestatic |
Compute the angle of the line passing through two points. Angle in [0,2pi]
- Parameters
-
- Returns
- an angle
Definition at line 540 of file FrechetShortcut.h.
553 return atan(alpha)+2*M_PI;
556 return atan(alpha)+M_PI;
◆ computeChainCode()
template<typename TIterator , typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
Computes the chain code between two 8-connected pixels
- Parameters
-
- Returns
- an int
Definition at line 589 of file FrechetShortcut.h.
Vector::Coordinate Coordinate
◆ computeOctant()
template<typename TIterator , typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
Computes the octant of the direction pq
- Parameters
-
- Returns
- an int
Definition at line 627 of file FrechetShortcut.h.
◆ isBetween()
template<typename TIterator , typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
static bool DGtal::FrechetShortcut< TIterator, TInteger >::Tools::isBetween |
( |
double |
i, |
|
|
double |
a, |
|
|
double |
b, |
|
|
double |
n |
|
) |
| |
|
inlinestatic |
Determines if i is between a and b in the oriented toric space modulo n
- Parameters
-
- Returns
- true if i is between a anb d, false otherwise
Definition at line 365 of file FrechetShortcut.h.
368 return (i>=a && i<=b);
370 return ((i>=a && i<=n) || (i>=0 && i<=b));
◆ rot()
template<typename TIterator , typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
Rotate the chain code d to put it in the frame where the octant 'quad' is treated as the first octant.
- Parameters
-
d | a chain code |
quad | the octant |
- Returns
- an int (the new chain code)
Definition at line 679 of file FrechetShortcut.h.
The documentation for this struct was generated from the following file: