DGtal 1.3.0
Loading...
Searching...
No Matches
DSLSubsegment.h
1
17#pragma once
18
29#if defined(DSLSubsegment_RECURSES)
30#error Recursive header files inclusion detected in DSLSubsegment.h
31#else // defined(DSLSubsegment_RECURSES)
33#define DSLSubsegment_RECURSES
34
35#if !defined DSLSubsegment_h
37#define DSLSubsegment_h
38
40// Inclusions
41#include <iostream>
42#include <exception>
43#include <iomanip>
44#include "DGtal/base/Common.h"
46
47#include "DGtal/arithmetic/IntegerComputer.h"
48
49namespace DGtal
50{
51
53// class DSLSubsegment
68
70
71
73
74 template <typename TInteger, typename TNumber>
76 {
77 // ----------------------- Standard services ------------------------------
78 public:
79
84
85 // ----------------------- Interface --------------------------------------
86 public:
87
92 void selfDisplay ( std::ostream & out ) const;
93
98 bool isValid() const;
99
103 typedef TNumber Number;
104 typedef TInteger Integer;
105 typedef long double LongDoubleType;
106
107
113
118
123
128
133
140
141 protected:
148
155
162
168
169 public:
184 DSLSubsegment(Number a, Number b, Number mu, Point &A, Point &B, std::string type);
185
198 DSLSubsegment(Number alpha, Number beta, Point &A, Point &B, Number precision = 1e-10);
199
200
201 protected:
212
223
229
230
234 class RayC
235 {
236 public :
237
243
248
254
260 RayC(const Integer x0, const Integer y0);
261
270 RayC(const Integer p, const Integer q, const Integer r, const Integer slope);
271
273
274 };
275
279 typedef enum Position
280 {
283 ONTO
285
286
298
299
312
324
335 void update(Vector &u, Point &A, Vector &l, Integer r, Vector *v);
336
347 void update(Vector &u, Point &A, Number s, Vector *v);
348
366 Point *prevInfL, Point *infL, Point *infR, Point *prevInfR);
367
381
392
410 Point *inf, Point *sup, Point *prevInf, Point *prevSup, bool inv);
411
412
425
426
435
436
450
466
481
482
493
494
504
520
521
553 Number a, Number b, Number mu, Integer n, bool *flagRayFound);
554
584 Number alpha, Number beta, Integer n, bool *flagRayFound);
585
586
587
607 Integer r, Number a, Number b, Number mu, Integer n);
608
609
628 Integer r, Number alpha, Number beta, Integer n);
629
630
642
643
673 RayC r, Integer n, Integer *resAlphaP,
674 Integer *resAlphaQ, Integer *resBetaP, bool found); // resBetaQ = resAlphaQ
675
697 RayC r, Integer n, Integer *resAlphaP, Integer *resAlphaQ,
698 Integer *resBetaP); // resBetaQ = resAlphaQ
699
700
701 public :
704
705
706 // ------------------------- Accessors ------------------------------
707
708 public:
709
713 Integer getA() const;
717 Integer getB() const;
721 Integer getMu() const;
722
723
724 };
725
726
727}// namespace DGtal
728
729
730
731 //Includes inline functions.
732#include "DSLSubsegment.ih"
733
734
735// //
737
738#endif // !defined DSLSubsegment_h
739
740#undef DSLSubsegment_RECURSES
741#endif // else defined(DSLSubsegment_RECURSES)
RayC(const Integer p, const Integer q, const Integer r, const Integer slope)
RayC(const Integer x0, const Integer y0)
Aim: Given a Digital Straight line and two endpoints A and B on this line, compute the minimal charac...
Definition: DSLSubsegment.h:76
void update(Vector &u, Point &A, Number s, Vector *v)
Integer slope(Integer p, Integer q, Integer r, Number alpha, Number beta)
Integer smartFirstDichotomy(Integer fp, Integer fq, Integer gp, Integer gq, Number alpha, Number beta, Integer n, bool *flagRayFound)
Integer smartFirstDichotomy(Integer fp, Integer fq, Integer gp, Integer gq, Number a, Number b, Number mu, Integer n, bool *flagRayFound)
DGtal::PointVector< 2, Number > VectorF
void shortFindSolution(Integer fp, Integer fq, Integer gp, Integer gq, RayC r, Integer n, Integer *resAlphaP, Integer *resAlphaQ, Integer *resBetaP)
Integer getMu() const
void DSLSubsegmentLocalCH(Number a, Number b, Number mu, Point &A, Point &B)
RayC raySup(Integer fp, Integer fq, RayC r)
DSLSubsegment(Number alpha, Number beta, Point &A, Point &B, Number precision=1e-10)
Integer intersection(Point &P, Vector &v, Number s)
void convexHullApprox(Vector &l, Integer r, Integer n, Point *inf, Point *sup)
DGtal::PointVector< 2, Integer > Vector
void lowerConvexHull(Vector &l, Integer mu, Point &A, Point &B, Point *prevInfL, Point *infL, Point *infR, Point *prevInfR)
Position positionWrtRay(RayC &r, Number alpha, Number beta)
RayC rayOfHighestSlope(Integer p, Integer q, Integer r, Integer smallestSlope, Integer n)
Integer intersection(Point &P, Vector &v, Vector &aL, Integer r)
void convexHullHarPeled(Vector &l, Integer n, Point *inf, Point *sup)
BOOST_CONCEPT_ASSERT((concepts::CInteger< Integer >))
Integer intersectionVertical(Point &P, Vector &v, Integer n)
RayC localizeRay(Integer fp, Integer fq, Integer gp, Integer gq, Integer r, Number a, Number b, Number mu, Integer n)
DGtal::PointVector< 2, Integer > Point
void DSLSubsegmentFareyFan(Number a, Number b, Number mu, Point &A, Point &B)
Integer computeMaxRemainder(Number a, Number b, Number mu, Point A, Point B)
long double LongDoubleType
void convexHullApproxTwoPoints(Vector &l, Integer r, Integer n, Point *inf, Point *sup, Point *prevInf, Point *prevSup, bool inv)
RayC localizeRay(Integer fp, Integer fq, Integer gp, Integer gq, Integer r, Number alpha, Number beta, Integer n)
RayC smartRayOfSmallestSlope(Integer fp, Integer fq, Integer gp, Integer gq, Integer r)
DGtal::PointVector< 2, Integer > Ray
Point nextTermInFareySeriesEuclid(Integer fp, Integer fq, Integer n)
void selfDisplay(std::ostream &out) const
Position positionWrtRay(RayC &r, Number a, Number b, Number mu)
Integer getB() const
void convexHullApprox(Number s, Integer n, Point *inf, Point *sup)
void findSolutionWithoutFractions(Integer fp, Integer fq, Integer gp, Integer gq, RayC r, Integer n, Integer *resAlphaP, Integer *resAlphaQ, Integer *resBetaP, bool found)
void update(Vector &u, Point &A, Vector &l, Integer r, Vector *v)
Integer getA() const
Integer computeMinRemainder(Number a, Number b, Number mu, Point A, Point B)
Integer slope(Integer p, Integer q, Integer r, Number a, Number b, Number mu)
DGtal::PointVector< 2, Number > PointF
bool isValid() const
BOOST_CONCEPT_ASSERT((concepts::CEuclideanRing< Number >))
DSLSubsegment(Number a, Number b, Number mu, Point &A, Point &B, std::string type)
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
DGtal is the top-level namespace which contains all DGtal functions and types.
auto inf(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs))
Implements the infimum (or greatest lower bound).
auto sup(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs))
Implements the supremum (or least upper bound).
Aim: Defines the mathematical concept equivalent to a unitary commutative ring with a division operat...
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:88