DGtal 1.4.2
|
Aim: This class represents a naive (resp. standard) digital straight line (DSL), ie. the set of digital points \( (x,y) \in \mathbb{Z}^2 \) such that \( \mu \leq ax - by < \mu + \omega \) with \( a,b,\mu,\omega \in \mathbb{Z} \), \( \gcd(a,b) = 1 \) and \( \omega = \max(|a|,|b|) \) (resp. \( \omega = |a| + |b| \)). Note that any DSL such that \( \omega = \max(|a|,|b|) \) (resp. \( \omega = |a| + |b| \)) is simply 8-connected (resp. 4-connected). More...
#include <DGtal/geometry/curves/ArithmeticalDSL.h>
Data Structures | |
class | ConstIterator |
Aim: This class aims at representing an iterator that provides a way to scan the points of a DSL. It is both a model of readable iterator and of bidirectional iterator. More... | |
Public Types | |
typedef TCoordinate | Coordinate |
typedef TInteger | Integer |
typedef ArithmeticalDSLKernel< Coordinate, adjacency >::Space | Space |
typedef Space::Point | Point |
typedef Space::Vector | Vector |
typedef std::pair< Vector, Vector > | Steps |
typedef Coordinate | Position |
typedef std::pair< unsigned char, unsigned char > | Octant |
typedef DGtal::ReverseIterator< ConstIterator > | ConstReverseIterator |
Static Public Member Functions | |
static Integer | remainder (const Coordinate &aA, const Coordinate &aB, const Point &aPoint) |
static Coordinate | toCoordinate (const Integer &aI) |
Static Public Attributes | |
static const unsigned short | foregroundAdjacency = adjacency |
Protected Attributes | |
Steps | mySteps |
Vector | myShift |
Coordinate | myA |
Coordinate | myB |
Integer | myLowerBound |
Integer | myUpperBound |
Friends | |
class | ArithmeticalDSS< TCoordinate, TInteger, adjacency > |
Aim: This class represents a naive (resp. standard) digital straight line (DSL), ie. the set of digital points \( (x,y) \in \mathbb{Z}^2 \) such that \( \mu \leq ax - by < \mu + \omega \) with \( a,b,\mu,\omega \in \mathbb{Z} \), \( \gcd(a,b) = 1 \) and \( \omega = \max(|a|,|b|) \) (resp. \( \omega = |a| + |b| \)). Note that any DSL such that \( \omega = \max(|a|,|b|) \) (resp. \( \omega = |a| + |b| \)) is simply 8-connected (resp. 4-connected).
[Reveilles, 1991 : [102]].
A naive DSL can be declared and constructed as follows:
See Digital straight lines and segments for further details.
This class is a model of CPointFunctor and of CConstBidirectionalRange.
In the standard case, it is enough to replace 8 by 4.
TCoordinate | a model of integer for the DGtal point coordinates and the slope parameters. |
TInteger | a model of integer for the intercepts and the remainders that represents a larger range of integers than TCoordinate. |
adjacency | an unsigned integer equal to 8 (default) for naive DSL, and 4 for standard DSL. |
Definition at line 106 of file ArithmeticalDSL.h.
DGtal::ReverseIterator<ConstIterator> DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstReverseIterator |
Type of const reverse iterator, adapted from ConstIterator.
Definition at line 297 of file ArithmeticalDSL.h.
TCoordinate DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::Coordinate |
Type used for the points coordinates and the slope parameters.
Definition at line 127 of file ArithmeticalDSL.h.
TInteger DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::Integer |
Type used for the intercepts and the remainders.
Definition at line 132 of file ArithmeticalDSL.h.
std::pair<unsigned char, unsigned char> DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::Octant |
Type of the octant values, defined as a STL pair of int
Definition at line 158 of file ArithmeticalDSL.h.
Space::Point DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::Point |
Type of point.
Definition at line 141 of file ArithmeticalDSL.h.
Coordinate DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::Position |
Type used for the position of a point in the DSL.
Definition at line 153 of file ArithmeticalDSL.h.
ArithmeticalDSLKernel<Coordinate,adjacency>::Space DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::Space |
Type of digital plane.
Definition at line 137 of file ArithmeticalDSL.h.
std::pair<Vector,Vector> DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::Steps |
Type of step vectors, defined as STL pair of vectors.
Definition at line 149 of file ArithmeticalDSL.h.
Space::Vector DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::Vector |
Type of vector.
Definition at line 145 of file ArithmeticalDSL.h.
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ArithmeticalDSL | ( | const Coordinate & | aA, |
const Coordinate & | aB, | ||
const Integer & | aLowerIntercept, | ||
const Integer & | aUpperIntercept, | ||
const Steps & | aSteps, | ||
const Vector & | aShift ) |
Constructor. The user gives all the (redondant) parameters and should be sure that the resulting DSL is valid.
aA | y-component of the direction vector |
aB | x-component of the direction vector |
aLowerIntercept | lower intercept |
aUpperIntercept | upper intercept |
aSteps | pair of steps used to iterate over the DSL points |
aShift | shift vector |
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ArithmeticalDSL | ( | const Coordinate & | aA, |
const Coordinate & | aB, | ||
const Integer & | aMu ) |
Constructor with the minimal set of parameters.
aA | y-component of the direction vector |
aB | x-component of the direction vector |
aMu | intercept |
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ArithmeticalDSL | ( | const ArithmeticalDSL< TCoordinate, TInteger, adjacency > & | aOther | ) |
Copy constructor.
aOther | the object to clone. |
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::~ArithmeticalDSL | ( | ) |
Destructor.
Coordinate DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::a | ( | ) | const |
Referenced by exampleNaiveDSL(), and exampleStandardDSL().
Coordinate DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::b | ( | ) | const |
Referenced by exampleNaiveDSL(), and exampleStandardDSL().
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::before | ( | const Point & | aP1, |
const Point & | aP2 ) const |
Returns a boolean equal to 'true' if aP1 is located (strictly) before aP2 in the direction orthogonal to myShift, 'false' otherwise.
aP1 | any point |
aP2 | any point |
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::beforeOrEqual | ( | const Point & | aP1, |
const Point & | aP2 ) const |
ConstIterator DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::begin | ( | const Point & | aPoint | ) | const |
aPoint | any point of the DSL |
Referenced by exampleNaiveDSL(), and exampleStandardDSL().
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::BOOST_CONCEPT_ASSERT | ( | (concepts::CInteger< Coordinate >) | ) |
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::BOOST_CONCEPT_ASSERT | ( | (concepts::CInteger< Integer >) | ) |
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::checkShiftAndSteps | ( | ) | const |
Checks the consistency between the slope parameters, ie. myA , myB and the translating vectors myShift , mySteps
ConstIterator DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::end | ( | const Point & | aPoint | ) | const |
aPoint | any point of the DSL |
Referenced by exampleNaiveDSL(), and exampleStandardDSL().
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::equalsTo | ( | const ArithmeticalDSL< TCoordinate, TInteger, adjacency > & | aOther | ) | const |
Equality.
aOther | the object to compare with. |
Point DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::getPoint | ( | ) | const |
Returns the unique point of the DSL located at position zero in O(1).
Point DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::getPoint | ( | const Position & | aPosition | ) | const |
Returns the unique point of the DSL located at position aPosition in O(1).
aPosition | position of the returned point |
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::isInDSL | ( | const Point & | aPoint | ) | const |
aPoint | any point |
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::isLowerLeaningPoint | ( | const Point & | aPoint | ) | const |
Test if a point is a lower leaning point of *this
aPoint | a point |
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::isUpperLeaningPoint | ( | const Point & | aPoint | ) | const |
Test if a point is an upper leaning point of *this
aPoint | a point |
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
NB: runs in O( log( max( |myA |,| myB | ) ) ) because it checks if myA and myB are relatively primes.
Referenced by exampleArithmeticalDSLTypes().
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::mu | ( | ) | const |
ArithmeticalDSL DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::negate | ( | ) | const |
Returns a copy of '*this' with a reverse orientation, ie. with parameters ( -myA , -myB , -myUpperIntercept , -myLowerIntercept).
Referenced by exampleNaiveDSL(), and exampleStandardDSL().
Octant DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::octant | ( | ) | const |
Returns the octants of the DSL as a pair of integers. If the parameters are such that \( abs(@a myA) =
abs(@a myB) \) or \( @a myA = 0 \) or \( @a myB = 0 \), it returns two octants (for instance octants 0 and 7 if \( @a myA = 0 \)).
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::omega | ( | ) | const |
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::operator!= | ( | const ArithmeticalDSL< TCoordinate, TInteger, adjacency > & | aOther | ) | const |
Difference.
aOther | the object to compare with. |
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::operator() | ( | const Point & | aPoint | ) | const |
ArithmeticalDSL & DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::operator= | ( | const ArithmeticalDSL< TCoordinate, TInteger, adjacency > & | aOther | ) |
Assignment.
aOther | the object to copy. |
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::operator== | ( | const ArithmeticalDSL< TCoordinate, TInteger, adjacency > & | aOther | ) | const |
Equality.
aOther | the object to compare with. |
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::orthogonalPosition | ( | const Point & | aPoint | ) | const |
Returns the position of aPoint (which does not necessarily belong to the DSL) computed along the direction that is orthogonal to the direction vector
aPoint | the point whose position is returned |
Position DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::patternLength | ( | ) | const |
Position DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::position | ( | const Point & | aPoint | ) | const |
Returns the position of aPoint (which does not necessarily belong to the DSL) computed along the direction orthogonal to myShift
aPoint | the point whose position is returned |
ConstReverseIterator DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::rbegin | ( | const Point & | aPoint | ) | const |
aPoint | any point of the DSL |
|
static |
Returns the remainder of aPoint with respect to the direction vector of components aA and aB
aA | y-component of the direction vector |
aB | x-component of the direction vector |
aPoint | any point |
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::remainder | ( | const Point & | aPoint | ) | const |
Returns the remainder of aPoint (which does not necessarily belong to the DSL)
aPoint | any point |
ConstReverseIterator DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::rend | ( | const Point & | aPoint | ) | const |
aPoint | any point of the DSL |
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::sameOctant | ( | const ArithmeticalDSL< TCoordinate, TInteger, adjacency > & | aOther, |
typename Octant::first_type * | theOctant ) const |
Test if DSLs lie in the same octant.
aOther | the object to compare with. | |
[out] | theOctant | where to store the common octant if the DSLs are in the same octant. |
void DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Vector DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::shift | ( | ) | const |
Steps DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::steps | ( | ) | const |
|
static |
|
friend |
Definition at line 672 of file ArithmeticalDSL.h.
|
static |
Adjacency of the DSL.
Definition at line 118 of file ArithmeticalDSL.h.
|
protected |
y-component of the direction vector
Definition at line 641 of file ArithmeticalDSL.h.
|
protected |
x-component of the direction vector
Definition at line 645 of file ArithmeticalDSL.h.
|
protected |
Lower intercept. Invariants:
Definition at line 651 of file ArithmeticalDSL.h.
|
protected |
Shift vector. It is computed from myA and myB in ArithmeticalDSLKernel.
Definition at line 635 of file ArithmeticalDSL.h.
|
protected |
Pair of steps used to iterate over the DSL points. They are computed from myA and myB in ArithmeticalDSLKernel.
Definition at line 630 of file ArithmeticalDSL.h.
|
protected |
Upper intercept. Invariants:
Definition at line 658 of file ArithmeticalDSL.h.