DGtal 1.4.0
Loading...
Searching...
No Matches
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)
35#define ArithmeticalDSLKernel_RECURSES
36
37#if !defined ArithmeticalDSLKernel_h
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
50namespace 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 is the top-level namespace which contains all DGtal functions and types.
static Steps steps(const TInteger &a, const TInteger &b)
BOOST_STATIC_CONSTANT(unsigned short, ForegroundAdjacency=4)
BOOST_STATIC_CONSTANT(unsigned short, BackgroundAdjacency=8)
static TInteger norm(const TInteger &a, const TInteger &b)
static Vector shift(const TInteger &a, const TInteger &b)
Aim: Small class that contains the code that depends on the arithmetical thickness (either naive or s...
BOOST_STATIC_CONSTANT(unsigned short, BackgroundAdjacency=4)
static TInteger norm(const TInteger &a, const TInteger &b)
BOOST_STATIC_CONSTANT(unsigned short, ForegroundAdjacency=8)
static Vector shift(const TInteger &a, const TInteger &b)
std::pair< Vector, Vector > Steps
static Steps steps(const TInteger &a, const TInteger &b)
SpaceND< 2, TCoordinate > Space