DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::NaiveDSL< TCoordinate, TInteger > Class Template Reference

Aim: This class is an alias of ArithmeticalDSS for naive DSL. It represents a naive 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|) \). Note that any DSL such that \( \omega = \max(|a|,|b|) \) is simply 8-connected. More...

#include <DGtal/geometry/curves/ArithmeticalDSL.h>

Inheritance diagram for DGtal::NaiveDSL< TCoordinate, TInteger >:
[legend]

Public Types

typedef ArithmeticalDSL< TCoordinate, TInteger, 8 > Super
 
typedef Super::Coordinate Coordinate
 
typedef Super::Integer Integer
 
- Public Types inherited from DGtal::ArithmeticalDSL< TCoordinate, TCoordinate, 8 >
typedef TCoordinate Coordinate
 
typedef TCoordinate Integer
 
typedef ArithmeticalDSLKernel< Coordinate, adjacency >::Space Space
 
typedef Space::Point Point
 
typedef Space::Vector Vector
 
typedef std::pair< Vector, VectorSteps
 
typedef Coordinate Position
 
typedef std::pair< unsigned char, unsigned char > Octant
 
typedef DGtal::ReverseIterator< ConstIterator > ConstReverseIterator
 

Public Member Functions

 NaiveDSL (const Coordinate &aA, const Coordinate &aB, const Integer &aMu)
 
 NaiveDSL (const NaiveDSL &aOther)
 
NaiveDSLoperator= (const NaiveDSL &aOther)
 
- Public Member Functions inherited from DGtal::ArithmeticalDSL< TCoordinate, TCoordinate, 8 >
 BOOST_CONCEPT_ASSERT ((concepts::CInteger< Coordinate >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CInteger< Integer >))
 
 ArithmeticalDSL (const Coordinate &aA, const Coordinate &aB, const Integer &aLowerIntercept, const Integer &aUpperIntercept, const Steps &aSteps, const Vector &aShift)
 
 ArithmeticalDSL (const Coordinate &aA, const Coordinate &aB, const Integer &aMu)
 
 ArithmeticalDSL (const ArithmeticalDSL &aOther)
 
ArithmeticalDSLoperator= (const ArithmeticalDSL &aOther)
 
ArithmeticalDSL negate () const
 
bool equalsTo (const ArithmeticalDSL &aOther) const
 
bool operator== (const ArithmeticalDSL &aOther) const
 
bool operator!= (const ArithmeticalDSL &aOther) const
 
bool sameOctant (const ArithmeticalDSL &aOther, typename Octant::first_type *theOctant) const
 
bool isUpperLeaningPoint (const Point &aPoint) const
 
bool isLowerLeaningPoint (const Point &aPoint) const
 
Octant octant () const
 
 ~ArithmeticalDSL ()
 
void selfDisplay (std::ostream &out) const
 
bool checkShiftAndSteps () const
 
bool isValid () const
 
Coordinate a () const
 
Coordinate b () const
 
Integer mu () const
 
Integer omega () const
 
Position patternLength () const
 
Vector shift () const
 
Steps steps () const
 
Integer remainder (const Point &aPoint) const
 
Integer orthogonalPosition (const Point &aPoint) const
 
Position position (const Point &aPoint) const
 
Point getPoint () const
 
Point getPoint (const Position &aPosition) const
 
bool before (const Point &aP1, const Point &aP2) const
 
bool beforeOrEqual (const Point &aP1, const Point &aP2) const
 
bool isInDSL (const Point &aPoint) const
 
bool operator() (const Point &aPoint) const
 
ConstIterator begin (const Point &aPoint) const
 
ConstIterator end (const Point &aPoint) const
 
ConstReverseIterator rbegin (const Point &aPoint) const
 
ConstReverseIterator rend (const Point &aPoint) const
 

Additional Inherited Members

- Static Public Member Functions inherited from DGtal::ArithmeticalDSL< TCoordinate, TCoordinate, 8 >
static Integer remainder (const Coordinate &aA, const Coordinate &aB, const Point &aPoint)
 
static Coordinate toCoordinate (const Integer &aI)
 
- Static Public Attributes inherited from DGtal::ArithmeticalDSL< TCoordinate, TCoordinate, 8 >
static const unsigned short foregroundAdjacency
 
- Protected Attributes inherited from DGtal::ArithmeticalDSL< TCoordinate, TCoordinate, 8 >
Steps mySteps
 
Vector myShift
 
Coordinate myA
 
Coordinate myB
 
Integer myLowerBound
 
Integer myUpperBound
 

Detailed Description

template<typename TCoordinate, typename TInteger = TCoordinate>
class DGtal::NaiveDSL< TCoordinate, TInteger >

Aim: This class is an alias of ArithmeticalDSS for naive DSL. It represents a naive 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|) \). Note that any DSL such that \( \omega = \max(|a|,|b|) \) is simply 8-connected.

[Reveilles, 1991 : [99]].

As a quick start, a naive DSL can be declared and constructed as follows:

// Construct a naive DSL from a, b, mu
NaiveDSL<Integer> line( 2, 5, 0 );

Then, within a window defined by two points (called firstPoint and lastPoint below), you can iterate over the DSL points:

// Draw the DSL points between firstPoint and lastPoint
for ( NaiveDSL<Integer>::ConstIterator
it = line.begin(firstPoint),
ite = line.end(lastPoint);
it != ite; ++it )
{
board << SetMode( it->className(), "Paving" )
<< *it; //Draw the point
}

See Digital straight lines and segments for further details.

Template Parameters
TCoordinatea model of integer for the DGtal point coordinates and the slope parameters.
TIntegera model of integer for the intercepts and the remainders that represents a larger range of integers than TCoordinate.

This class is a model of CPointFunctor and of CConstBidirectionalRange.

See also
ArithmeticalDSL NaiveDSL StandardDSL
exampleArithmeticalDSL.cpp
Examples
geometry/curves/exampleArithmeticalDSL.cpp, and geometry/curves/exampleArithmeticalDSS.cpp.

Definition at line 776 of file ArithmeticalDSL.h.

Member Typedef Documentation

◆ Coordinate

template<typename TCoordinate , typename TInteger = TCoordinate>
typedef Super::Coordinate DGtal::NaiveDSL< TCoordinate, TInteger >::Coordinate

Definition at line 784 of file ArithmeticalDSL.h.

◆ Integer

template<typename TCoordinate , typename TInteger = TCoordinate>
typedef Super::Integer DGtal::NaiveDSL< TCoordinate, TInteger >::Integer

Definition at line 785 of file ArithmeticalDSL.h.

◆ Super

template<typename TCoordinate , typename TInteger = TCoordinate>
typedef ArithmeticalDSL<TCoordinate, TInteger, 8> DGtal::NaiveDSL< TCoordinate, TInteger >::Super

Type of base class.

Definition at line 783 of file ArithmeticalDSL.h.

Constructor & Destructor Documentation

◆ NaiveDSL() [1/2]

template<typename TCoordinate , typename TInteger = TCoordinate>
DGtal::NaiveDSL< TCoordinate, TInteger >::NaiveDSL ( const Coordinate & aA,
const Coordinate & aB,
const Integer & aMu )

Constructor.

Parameters
aAy-component of the direction vector
aBx-component of the direction vector
aMuintercept

◆ NaiveDSL() [2/2]

template<typename TCoordinate , typename TInteger = TCoordinate>
DGtal::NaiveDSL< TCoordinate, TInteger >::NaiveDSL ( const NaiveDSL< TCoordinate, TInteger > & aOther)

Copy constructor.

Parameters
aOtherthe object to clone.

Member Function Documentation

◆ operator=()

template<typename TCoordinate , typename TInteger = TCoordinate>
NaiveDSL & DGtal::NaiveDSL< TCoordinate, TInteger >::operator= ( const NaiveDSL< TCoordinate, TInteger > & aOther)

Assignment.

Parameters
aOtherthe object to copy.
Returns
a reference on 'this'.

The documentation for this class was generated from the following file: