DGtal  0.9.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)
34 
35 #define ImplicitFunctionDiff1LinearCellEmbedder_RECURSES
36 
37 #if !defined ImplicitFunctionDiff1LinearCellEmbedder_h
38 
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 >
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;
95  typedef typename ImplicitFunctionDiff1::Value ImplicitFctValue;
96  typedef Cell Argument;
97  typedef RealPoint Value;
100 
105 
110 
116 
124 
135 
136  // ----------------------- Interface --------------------------------------
137  public:
138 
142  GradientMap gradientMap() const;
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;
238  const ImplicitFunctionDiff1* myPtrFct;
240  const Embedder* myPtrEmbedder;
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,
298  const ImplicitFunctionDiff1LinearCellEmbedder<TKSpace, TImplicitFunctionDiff1, TEmbedder> & object );
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: a cellular embedder for implicit functions, (default constructible, copy constructible, assignable). Model of CCellEmbedder and CWithGradientMap.
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
const KSpace * myPtrK
A pointer on the cellular grid space.
RealPoint embedCell(const Cell &cell) const
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
const Embedder * myPtrEmbedder
A pointer on the digital embedder.
void selfDisplay(std::ostream &out) const
ImplicitFunctionDiff1LinearCellEmbedderGradientMap< TKSpace, TImplicitFunctionDiff1, TEmbedder > Self
ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder > Base
void init(ConstAlias< KSpace > K, ConstAlias< ImplicitFunctionDiff1 > f, ConstAlias< Embedder > e)
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Aim: Describes a 1-differentiable function of the form f(x), where x is some real point in the given ...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
RealPoint embed(const Point &p) const
Aim: A point embedder is a mapping from digital points to Euclidean points. It adds inner types to fu...
ImplicitFunctionDiff1LinearCellEmbedder & operator=(const ImplicitFunctionDiff1LinearCellEmbedder &other)
const ImplicitFunctionDiff1 * myPtrFct
A pointer on the implicit function.
RealPoint embedSCell(const SCell &scell) const
RealPoint operator()(const Cell &cell) const
ImplicitFunctionDiff1LinearCellEmbedderGradientMap< KSpace, ImplicitFunctionDiff1, Embedder > GradientMap