31#if defined(ArithmeticalDSL_RECURSES)
32#error Recursive header files inclusion detected in ArithmeticalDSL.h
35#define ArithmeticalDSL_RECURSES
37#if !defined ArithmeticalDSL_h
39#define ArithmeticalDSL_h
45#include "DGtal/base/Common.h"
46#include "DGtal/base/Exceptions.h"
47#include "DGtal/base/ReverseIterator.h"
48#include "DGtal/kernel/CInteger.h"
49#include "DGtal/kernel/CSignedNumber.h"
50#include "DGtal/kernel/SpaceND.h"
51#include "DGtal/kernel/PointVector.h"
52#include "DGtal/arithmetic/IntegerComputer.h"
54#include "DGtal/geometry/curves/ArithmeticalDSLKernel.h"
62 template <
typename TCoordinate,
64 unsigned short adjacency>
65 class ArithmeticalDSS;
103 template <
typename TCoordinate,
104 typename TInteger = TCoordinate,
105 unsigned short adjacency = 8>
149 typedef std::pair<Vector,Vector>
Steps;
158 typedef std::pair<unsigned char, unsigned char>
Octant;
178 :
public boost::iterator_facade<ConstIterator,
180 boost::random_access_traversal_tag,
671 template <
typename TCoordinate,
typename TInteger,
unsigned short adjacency>
707 template <
typename TCoordinate,
typename TInteger = TCoordinate>
775 template <
typename TCoordinate,
typename TInteger = TCoordinate>
830 template <
typename TInput,
typename TOutput >
842 static TOutput
cast(
const TInput& aInput)
844 return static_cast<TOutput
>(aInput);
847#ifdef WITH_BIGINTEGER
849 template <
typename TOutput>
858 ASSERT( (aInput <=
static_cast<DGtal::BigInteger>(std::numeric_limits<TOutput>::max())) &&
859 (aInput >=
static_cast<DGtal::BigInteger>(std::numeric_limits<TOutput>::min())) );
860 return static_cast<TOutput
>(aInput.get_si());
881#include "DGtal/geometry/curves/ArithmeticalDSL.ih"
888#undef ArithmeticalDSL_RECURSES
Aim: This class aims at representing an iterator that provides a way to scan the points of a DSL....
Integer myQuantityToAdd
Quantity to add to the current remainder.
Integer remainder() const
Point myCurrentPoint
The current point.
Position distance_to(const ConstIterator &aOther) const
ConstIterator(const ArithmeticalDSL *aDSL, const Point &aPoint)
ConstIterator(const ConstIterator &aOther)
Integer myCurrentRemainder
Remainder of the current point.
void advance(const Position &aShift)
bool equal(const ConstIterator &aOther) const
const ArithmeticalDSL * myDSLPtr
Constant aliasing pointer to the DSL visited by the iterator.
Integer myQuantityToRemove
Quantity to remove to the current remainder.
Point const dereference() const
friend class boost::iterator_core_access
ConstIterator & operator=(const ConstIterator &aOther)
Aim: This class represents a naive (resp. standard) digital straight line (DSL), ie....
bool isUpperLeaningPoint(const Point &aPoint) const
bool equalsTo(const ArithmeticalDSL &aOther) const
bool operator()(const Point &aPoint) const
ArithmeticalDSL & operator=(const ArithmeticalDSL &aOther)
ArithmeticalDSL negate() const
Point getPoint(const Position &aPosition) const
std::pair< Vector, Vector > Steps
bool before(const Point &aP1, const Point &aP2) const
BOOST_CONCEPT_ASSERT((concepts::CInteger< Coordinate >))
static const unsigned short foregroundAdjacency
ArithmeticalDSL(const Coordinate &aA, const Coordinate &aB, const Integer &aLowerIntercept, const Integer &aUpperIntercept, const Steps &aSteps, const Vector &aShift)
ArithmeticalDSL(const ArithmeticalDSL &aOther)
std::pair< unsigned char, unsigned char > Octant
Integer remainder(const Point &aPoint) const
ConstIterator begin(const Point &aPoint) const
bool checkShiftAndSteps() const
bool beforeOrEqual(const Point &aP1, const Point &aP2) const
Position patternLength() const
bool isInDSL(const Point &aPoint) const
void selfDisplay(std::ostream &out) const
DGtal::ReverseIterator< ConstIterator > ConstReverseIterator
ArithmeticalDSL(const Coordinate &aA, const Coordinate &aB, const Integer &aMu)
bool operator==(const ArithmeticalDSL &aOther) const
bool sameOctant(const ArithmeticalDSL &aOther, typename Octant::first_type *theOctant) const
BOOST_CONCEPT_ASSERT((concepts::CInteger< Integer >))
ArithmeticalDSLKernel< Coordinate, adjacency >::Space Space
bool operator!=(const ArithmeticalDSL &aOther) const
bool isLowerLeaningPoint(const Point &aPoint) const
ConstIterator end(const Point &aPoint) const
Integer orthogonalPosition(const Point &aPoint) const
static Coordinate toCoordinate(const Integer &aI)
ConstReverseIterator rend(const Point &aPoint) const
Position position(const Point &aPoint) const
ConstReverseIterator rbegin(const Point &aPoint) const
static Integer remainder(const Coordinate &aA, const Coordinate &aB, const Point &aPoint)
Aim: This class represents a naive (resp. standard) digital straight segment (DSS),...
Aim: This class is an alias of ArithmeticalDSS for naive DSL. It represents a naive digital straight ...
NaiveDSL(const Coordinate &aA, const Coordinate &aB, const Integer &aMu)
NaiveDSL(const NaiveDSL &aOther)
NaiveDSL & operator=(const NaiveDSL &aOther)
Super::Coordinate Coordinate
ArithmeticalDSL< TCoordinate, TInteger, 8 > Super
This class adapts any bidirectional iterator so that operator++ calls operator-- and vice versa.
Aim: This class is an alias of ArithmeticalDSS for standard DSL. It represents a standard digital str...
Super::Coordinate Coordinate
StandardDSL(const StandardDSL &aOther)
StandardDSL(const Coordinate &aA, const Coordinate &aB, const Integer &aMu)
StandardDSL & operator=(const StandardDSL &aOther)
ArithmeticalDSL< TCoordinate, TInteger, 4 > Super
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Aim: Concept checking for Signed Numbers. Models of this concept should be listed in NumberTraits cla...
static DGtal::BigInteger cast(const DGtal::BigInteger &aInput)
BOOST_CONCEPT_ASSERT((concepts::CSignedNumber< TOutput >))
static TOutput cast(const DGtal::BigInteger &aInput)
BOOST_CONCEPT_ASSERT((concepts::CInteger< TOutput >))
Aim: Define a simple functor that can cast a signed integer (possibly a DGtal::BigInteger) into anoth...
BOOST_CONCEPT_ASSERT((concepts::CSignedNumber< TInput >))
BOOST_CONCEPT_ASSERT((concepts::CInteger< TOutput >))
BOOST_CONCEPT_ASSERT((concepts::CSignedNumber< TOutput >))
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInput >))
static TOutput cast(const TInput &aInput)