DGtal  1.1.0
ArithmeticalDSLKernel.h
1
17 #pragma once
18
31 #if defined(ArithmeticalDSLKernel_RECURSES)
32 #error Recursive header files inclusion detected in ArithmeticalDSLKernel.h
33 #else // defined(ArithmeticalDSLKernel_RECURSES)
34
35 #define ArithmeticalDSLKernel_RECURSES
36
37 #if !defined ArithmeticalDSLKernel_h
38
39 #define ArithmeticalDSLKernel_h
40
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45
46 #include "DGtal/kernel/SpaceND.h"
47 #include "DGtal/kernel/NumberTraits.h"
49
50 namespace DGtal
51 {
52
54  // template struct ArithmeticalDSLKernel
89  template <typename TCoordinate,
90  unsigned short adjacency = 8>
92  {
93
94  // ----------------------- Inner types ------------------------------------
95  public:
103  typedef typename Space::Vector Vector;
107  typedef std::pair<Vector, Vector> Steps;
108
109
110  // ----------------------- static members ---------------------------------
111  public:
115  BOOST_STATIC_CONSTANT(unsigned short, ForegroundAdjacency = 8); // adjacency
116
120  BOOST_STATIC_CONSTANT(unsigned short, BackgroundAdjacency = 4); // complementary adjacency
121
122  // ----------------------- static methods ---------------------------------
123  public:
142  template <typename TInteger>
143  static Vector shift(const TInteger& a, const TInteger& b);
144
169  template <typename TInteger>
170  static Steps steps(const TInteger& a, const TInteger& b);
171
182  template<typename TInteger>
183  static TInteger norm(const TInteger& a, const TInteger& b);
184
185  };
186
188  // specialization of the template struct ArithmeticalDSLKernel for 4-adjacency
189  template <typename TCoordinate>
190  struct ArithmeticalDSLKernel<TCoordinate, 4>
191  {
192  // ----------------------- Inner types ------------------------------------
193  public:
195  typedef typename Space::Vector Vector;
196  typedef std::pair<Vector, Vector> Steps;
197
198
199  // ----------------------- static members ---------------------------------
200  public:
204  BOOST_STATIC_CONSTANT(unsigned short, ForegroundAdjacency = 4); // adjacency
205
209  BOOST_STATIC_CONSTANT(unsigned short, BackgroundAdjacency = 8); // complementary adjacency
210
211  // ----------------------- static methods ---------------------------------
212  public:
213  template <typename TInteger>
214  static Vector shift(const TInteger& a, const TInteger& b);
215  template <typename TInteger>
216  static Steps steps(const TInteger& a, const TInteger& b);
217  template<typename TInteger>
218  static TInteger norm(const TInteger& a, const TInteger& b);
219
220  };
221
222 } // namespace DGtal
223
224
226 // Includes inline functions.
227 #include "DGtal/geometry/curves/ArithmeticalDSLKernel.ih"
228
229 // //
231
232 #endif // !defined ArithmeticalDSLKernel_h
233
234 #undef ArithmeticalDSLKernel_RECURSES
235 #endif // else defined(ArithmeticalDSLKernel_RECURSES)
DGtal::ArithmeticalDSLKernel::steps
static Steps steps(const TInteger &a, const TInteger &b)
DGtal::ArithmeticalDSLKernel< TCoordinate, 4 >::norm
static TInteger norm(const TInteger &a, const TInteger &b)
DGtal::ArithmeticalDSLKernel< TCoordinate, 4 >::Space
SpaceND< 2, TCoordinate > Space
Definition: ArithmeticalDSLKernel.h:194
DGtal::ArithmeticalDSLKernel::Space
SpaceND< 2, TCoordinate > Space
Definition: ArithmeticalDSLKernel.h:99
DGtal::ArithmeticalDSLKernel::BOOST_STATIC_CONSTANT
BOOST_STATIC_CONSTANT(unsigned short, ForegroundAdjacency=8)
DGtal::ArithmeticalDSLKernel< TCoordinate, 4 >::shift
static Vector shift(const TInteger &a, const TInteger &b)
DGtal::SpaceND
Definition: SpaceND.h:96
DGtal::ArithmeticalDSLKernel::Steps
std::pair< Vector, Vector > Steps
Definition: ArithmeticalDSLKernel.h:107
DGtal::ArithmeticalDSLKernel::norm
static TInteger norm(const TInteger &a, const TInteger &b)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::ArithmeticalDSLKernel
Aim: Small class that contains the code that depends on the arithmetical thickness (either naive or s...
Definition: ArithmeticalDSLKernel.h:92
DGtal::ArithmeticalDSLKernel::BOOST_STATIC_CONSTANT
BOOST_STATIC_CONSTANT(unsigned short, BackgroundAdjacency=4)
DGtal::ArithmeticalDSLKernel< TCoordinate, 4 >::steps
static Steps steps(const TInteger &a, const TInteger &b)
DGtal::PointVector< dim, Integer >
DGtal::ArithmeticalDSLKernel::Vector
Space::Vector Vector
Definition: ArithmeticalDSLKernel.h:103
DGtal::ArithmeticalDSLKernel< TCoordinate, 4 >::BOOST_STATIC_CONSTANT
BOOST_STATIC_CONSTANT(unsigned short, BackgroundAdjacency=8)
DGtal::ArithmeticalDSLKernel< TCoordinate, 4 >::BOOST_STATIC_CONSTANT
BOOST_STATIC_CONSTANT(unsigned short, ForegroundAdjacency=4)
DGtal::ArithmeticalDSLKernel::shift
static Vector shift(const TInteger &a, const TInteger &b)
DGtal::ArithmeticalDSLKernel< TCoordinate, 4 >::Vector
Space::Vector Vector
Definition: ArithmeticalDSLKernel.h:195
DGtal::ArithmeticalDSLKernel< TCoordinate, 4 >::Steps
std::pair< Vector, Vector > Steps
Definition: ArithmeticalDSLKernel.h:196