DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::ArithmeticalDSLKernel< TCoordinate, adjacency > Struct Template Reference

Aim: Small class that contains the code that depends on the arithmetical thickness (either naive or standard) of a digital straight line (DSL). It provides mainly two static methods: More...

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

Public Types

typedef SpaceND< 2, TCoordinate > Space
 
typedef Space::Vector Vector
 
typedef std::pair< Vector, VectorSteps
 

Public Member Functions

 BOOST_STATIC_CONSTANT (unsigned short, ForegroundAdjacency=8)
 
 BOOST_STATIC_CONSTANT (unsigned short, BackgroundAdjacency=4)
 

Static Public Member Functions

template<typename TInteger >
static Vector shift (const TInteger &a, const TInteger &b)
 
template<typename TInteger >
static Steps steps (const TInteger &a, const TInteger &b)
 
template<typename TInteger >
static TInteger norm (const TInteger &a, const TInteger &b)
 

Detailed Description

template<typename TCoordinate, unsigned short adjacency = 8>
struct DGtal::ArithmeticalDSLKernel< TCoordinate, adjacency >

Aim: Small class that contains the code that depends on the arithmetical thickness (either naive or standard) of a digital straight line (DSL). It provides mainly two static methods:

  • ArithmeticalDSLKernel::shift that returns the shift vector of a DSL from its slope parameters \( a \) and \( b \). ie. the vector \( s \) translating a point of remainder \( r \) to a point of remainder \( r + \omega \)
  • ArithmeticalDSLKernel::steps that returns the step vectors of a DSL ie. the couple of vectors \( v \) and \( w \) used to iterate over the points of a DSL in an orientation given by the DSL parameters \( a \) and \( b \). Obviously, these two vectors are equal to 0 if \( \omega = 0 \) (not valid DSL). Moreover, the first vector ( \( v \)) is equal to the direction vector, while the second one ( \( w \)) is equal to 0, if \( \omega = 1 \), ie. if the lower leaning line and the upper leaning line are counfounded. Though, in the general case, the first vector ( \( v \)) translates any point \( p \) of remainder \( r \) to its unique neighbor point \( q \) of remainder greater than or equal to \( r \), while the second one ( \( w \)) is such that \( v - w = s \).

These methods are specialized with respect to the chosen adjacency 8 (default) or 4.

Digital straight lines and segments

Template Parameters
TCoordinatea model of integer for the DGtal point coordinates
adjacencyinteger equal to 8 (default) for naive (simply 8-connected) DSL, and 4 for standard (simply 4-connected) DSL.
See also
ArithmeticalDSL
exampleArithmeticalDSL.cpp

Definition at line 91 of file ArithmeticalDSLKernel.h.

Member Typedef Documentation

◆ Space

template<typename TCoordinate , unsigned short adjacency = 8>
typedef SpaceND<2, TCoordinate> DGtal::ArithmeticalDSLKernel< TCoordinate, adjacency >::Space

Type of the digital plane.

Definition at line 99 of file ArithmeticalDSLKernel.h.

◆ Steps

template<typename TCoordinate , unsigned short adjacency = 8>
typedef std::pair<Vector, Vector> DGtal::ArithmeticalDSLKernel< TCoordinate, adjacency >::Steps

Type of the step vectors, defined as a STL pair of Vector

Definition at line 107 of file ArithmeticalDSLKernel.h.

◆ Vector

template<typename TCoordinate , unsigned short adjacency = 8>
typedef Space::Vector DGtal::ArithmeticalDSLKernel< TCoordinate, adjacency >::Vector

Type of the shift vector.

Definition at line 103 of file ArithmeticalDSLKernel.h.

Member Function Documentation

◆ BOOST_STATIC_CONSTANT() [1/2]

template<typename TCoordinate , unsigned short adjacency = 8>
DGtal::ArithmeticalDSLKernel< TCoordinate, adjacency >::BOOST_STATIC_CONSTANT ( unsigned short ,
BackgroundAdjacency = 4 )

Adjacency used for the complement

◆ BOOST_STATIC_CONSTANT() [2/2]

template<typename TCoordinate , unsigned short adjacency = 8>
DGtal::ArithmeticalDSLKernel< TCoordinate, adjacency >::BOOST_STATIC_CONSTANT ( unsigned short ,
ForegroundAdjacency = 8 )

Adjacency used for the DSL

◆ norm()

template<typename TCoordinate , unsigned short adjacency = 8>
template<typename TInteger >
static TInteger DGtal::ArithmeticalDSLKernel< TCoordinate, adjacency >::norm ( const TInteger & a,
const TInteger & b )
static

Returns the \( L_{\infty} \) (for the 8-adjacency) or the \( L_1 \) norm (for the 4-adjacency) of two integers a and b,

Parameters
aa-parameter
bb-parameter
Template Parameters
TIntegera model of integer for the parameters a and b
Returns
the norm

◆ shift()

template<typename TCoordinate , unsigned short adjacency = 8>
template<typename TInteger >
static Vector DGtal::ArithmeticalDSLKernel< TCoordinate, adjacency >::shift ( const TInteger & a,
const TInteger & b )
static

Given parameters a and b, this method computes the shift vector translating a point of remainder \( r \) to a point of remainder \( r + \omega \)

NB: The shift vector is set to (0,0) if \( \omega = 0 \), ie. a and b are both null.

NB: If ( a , b ) lies between two octants (resp. quadrants) (eg. b > 0 and a = 0), the shift vector of the next octant (resp. quadrant) is chosen with respect to the counter-clockwise orientation.

Parameters
aa-parameter
bb-parameter
Template Parameters
TIntegera model of integer for the parameters a and b
Returns
the shift vector
See also
exampleArithmeticalDSL.cpp

Referenced by specialCases(), and test().

◆ steps()

template<typename TCoordinate , unsigned short adjacency = 8>
template<typename TInteger >
static Steps DGtal::ArithmeticalDSLKernel< TCoordinate, adjacency >::steps ( const TInteger & a,
const TInteger & b )
static

Given parameters a and b, this method returns the two step vectors, ie. the vectors that are used to iterate over the points of a DSL of slope a / b.

In the general case, the first vector \( v \) translates any point \( p \) of remainder \( r \) to its unique neighbor point \( q \) of remainder greater than or equal to \( r \), while the second one \( w \) is such that \( v - w = s \).

NB: The two vectors are set to (0,0) if \( \omega = 0 \), ie. a and b are both null.

NB: The second vector is set to (0,0) if \( \omega = 1 \), ie. if either a or b is null, if either a == b or either a == - b in the naive case.

Parameters
aa-parameter
bb-parameter
Template Parameters
TIntegera model of integer for the parameters a and b
Returns
the the pair of steps
See also
exampleArithmeticalDSL.cpp

Referenced by specialCases(), and test().


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