DGtal  1.4.2
ImplicitFunctionDiff1LinearCellEmbedder.h
1 
17 #pragma once
18 
31 #if defined(ImplicitFunctionDiff1LinearCellEmbedder_RECURSES)
32 #error Recursive header files inclusion detected in ImplicitFunctionDiff1LinearCellEmbedder.h
33 #else // defined(ImplicitFunctionDiff1LinearCellEmbedder_RECURSES)
35 #define ImplicitFunctionDiff1LinearCellEmbedder_RECURSES
36 
37 #if !defined ImplicitFunctionDiff1LinearCellEmbedder_h
39 #define ImplicitFunctionDiff1LinearCellEmbedder_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/ConstAlias.h"
46 #include "DGtal/kernel/NumberTraits.h"
47 #include "DGtal/kernel/CPointEmbedder.h"
48 #include "DGtal/topology/CCellularGridSpaceND.h"
49 #include "DGtal/shapes/implicit/CImplicitFunction.h"
50 #include "DGtal/shapes/implicit/CImplicitFunctionDiff1.h"
52 
53 namespace DGtal
54 {
55 
57  template < typename TKSpace,
58  typename TImplicitFunctionDiff1,
59  typename TEmbedder >
60  class ImplicitFunctionDiff1LinearCellEmbedderGradientMap;
61 
63 
76  template < typename TKSpace,
77  typename TImplicitFunctionDiff1,
78  typename TEmbedder >
80  {
84 
85  public:
86  typedef TKSpace KSpace;
87  typedef TImplicitFunctionDiff1 ImplicitFunctionDiff1;
88  typedef TEmbedder Embedder;
89  typedef typename KSpace::Cell Cell;
90  typedef typename KSpace::SCell SCell;
91  typedef typename KSpace::Space Space;
92  typedef typename Space::Point Point;
93  typedef typename Space::RealPoint RealPoint;
94  typedef typename Space::RealVector RealVector;
96  typedef Cell Argument;
97  typedef RealPoint Value;
100 
105 
110 
116 
124 
135 
136  // ----------------------- Interface --------------------------------------
137  public:
138 
143 
151  RealPoint embed( const Point & p ) const;
152 
160  RealPoint embedCell( const Cell & cell ) const;
161 
170  RealPoint embedSCell( const SCell & scell ) const;
171 
179  RealPoint operator()( const Cell & cell ) const;
180 
190  void embed( const Point & p, RealPoint & x, RealVector & grad ) const;
191 
201  void embedCell( const Cell & cell,
202  RealPoint & x, RealVector & grad ) const;
203 
214  void embedSCell( const SCell & scell,
215  RealPoint & x, RealVector & grad ) const;
216 
217  // ----------------------- Interface --------------------------------------
218  public:
219 
224  void selfDisplay ( std::ostream & out ) const;
225 
230  bool isValid() const;
231 
232  // ------------------------- Protected Datas ------------------------------
233  protected:
234 
236  const KSpace* myPtrK;
241 
242  }; // end of class ImplicitFunctionDiff1LinearCellEmbedder
243 
248  template < typename TKSpace,
249  typename TImplicitFunctionDiff1,
250  typename TEmbedder >
252  : public ImplicitFunctionDiff1LinearCellEmbedder< TKSpace,
253  TImplicitFunctionDiff1,
254  TEmbedder>
255  {
256  public:
258  < TKSpace, TImplicitFunctionDiff1, TEmbedder> Self;
260  < TKSpace, TImplicitFunctionDiff1, TEmbedder> Base;
261  typedef typename Base::Cell Cell;
262  typedef typename Base::RealPoint RealPoint;
263  typedef typename Base::RealVector RealVector;
264  typedef Cell Argument;
265  typedef RealVector Value;
266  using Base::myPtrFct;
267 
268  inline
270  ( const Base & other )
271  : Base( other )
272  {}
273 
274  inline
275  Self & operator=( const Base & other )
276  {
277  Base::operator=( other );
278  return *this;
279  }
280 
281  inline
282  Value operator()( const Argument & arg ) const
283  {
284  RealPoint x = Base::operator()( arg );
285  return myPtrFct->gradient( x );
286  }
287  };
288 
295  template < typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder >
296  std::ostream&
297  operator<< ( std::ostream & out,
299 
300 } // namespace DGtal
301 
302 
304 // Includes inline functions.
305 #include "DGtal/shapes/implicit/ImplicitFunctionDiff1LinearCellEmbedder.ih"
306 
307 // //
309 
310 #endif // !defined ImplicitFunctionDiff1LinearCellEmbedder_h
311 
312 #undef ImplicitFunctionDiff1LinearCellEmbedder_RECURSES
313 #endif // else defined(ImplicitFunctionDiff1LinearCellEmbedder_RECURSES)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder > Base
const ImplicitFunctionDiff1 * myPtrFct
A pointer on the implicit function.
ImplicitFunctionDiff1LinearCellEmbedderGradientMap< TKSpace, TImplicitFunctionDiff1, TEmbedder > Self
Aim: a cellular embedder for implicit functions, (default constructible, copy constructible,...
void init(ConstAlias< KSpace > K, ConstAlias< ImplicitFunctionDiff1 > f, ConstAlias< Embedder > e)
ImplicitFunctionDiff1LinearCellEmbedder(const ImplicitFunctionDiff1LinearCellEmbedder &other)
void embedCell(const Cell &cell, RealPoint &x, RealVector &grad) const
RealPoint embedCell(const Cell &cell) const
RealPoint operator()(const Cell &cell) const
BOOST_CONCEPT_ASSERT((concepts::CImplicitFunctionDiff1< TImplicitFunctionDiff1 >))
void embed(const Point &p, RealPoint &x, RealVector &grad) const
const ImplicitFunctionDiff1 * myPtrFct
A pointer on the implicit function.
void selfDisplay(std::ostream &out) const
const KSpace * myPtrK
A pointer on the cellular grid space.
ImplicitFunctionDiff1LinearCellEmbedder & operator=(const ImplicitFunctionDiff1LinearCellEmbedder &other)
RealPoint embed(const Point &p) const
void embedSCell(const SCell &scell, RealPoint &x, RealVector &grad) const
BOOST_CONCEPT_ASSERT((concepts::CPointEmbedder< TEmbedder >))
const Embedder * myPtrEmbedder
A pointer on the digital embedder.
RealPoint embedSCell(const SCell &scell) const
ImplicitFunctionDiff1LinearCellEmbedderGradientMap< KSpace, ImplicitFunctionDiff1, Embedder > GradientMap
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
Aim: Describes a 1-differentiable function of the form f(x), where x is some real point in the given ...
Aim: A point embedder is a mapping from digital points to Euclidean points. It adds inner types to fu...
KSpace K
KSpace::Cell Cell