DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DGtal/shapes/Shapes.h
1 
17 #pragma once
18 
31 #if defined(Shapes_RECURSES)
32 #error Recursive header files inclusion detected in Shapes.h
33 #else // defined(Shapes_RECURSES)
34 
35 #define Shapes_RECURSES
36 
37 #if !defined Shapes_h
38 
39 #define Shapes_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/kernel/NumberTraits.h"
46 #include "DGtal/kernel/domains/CDomain.h"
47 #include "DGtal/kernel/domains/HyperRectDomain.h"
48 #include "DGtal/topology/KhalimskySpaceND.h"
49 #include "DGtal/topology/SurfelAdjacency.h"
50 #include "DGtal/topology/helpers/Surfaces.h"
51 #include "DGtal/shapes/CDigitalOrientedShape.h"
52 #include "DGtal/shapes/CDigitalBoundedShape.h"
53 #include "DGtal/shapes/CEuclideanOrientedShape.h"
54 #include "DGtal/shapes/CEuclideanBoundedShape.h"
55 #include "DGtal/shapes/GaussDigitizer.h"
57 
58 namespace DGtal
59 {
60 
62  // template class Shapes
70  template <typename TDomain>
71  class Shapes
72  {
73  // Concept checks
75 
76  // ----------------------- public types ------------------------------
77  public:
78  typedef TDomain Domain;
79  typedef typename Domain::Space Space;
80  typedef typename Domain::Space::RealPoint RealPoint;
81  typedef typename Domain::Point Point;
82  typedef typename Domain::Vector Vector;
83  typedef typename Domain::Predicate Predicate;
84  typedef typename Domain::ConstIterator ConstIterator;
85  //Arithmetic
86  typedef typename Space::Integer Integer;
87  typedef typename Space::UnsignedInteger UnsignedInteger;
88 
89  // ----------------------- Static services ------------------------------
90  public:
91 
103  template <typename TDigitalSet, typename TShapeFunctor>
104  static void digitalShaper( TDigitalSet & aSet,
105  const TShapeFunctor & aFunctor);
106 
122  template <typename TDigitalSet, typename TShapeFunctor>
123  static void euclideanShaper( TDigitalSet & aSet,
124  const TShapeFunctor & aFunctor,
125  const double h = 1.0);
126 
140  template < typename DigitalSet, typename PointPredicate >
141  static
142  void makeSetFromPointPredicate( DigitalSet & aSet,
143  const PointPredicate & aPP );
144 
145 
156  template<typename TDigitalSet>
157  static void addNorm1Ball( TDigitalSet & aSet,
158  const Point & aCenter,
159  UnsignedInteger aRadius );
160 
171  template <typename TDigitalSet>
172  static void addNorm2Ball( TDigitalSet & aSet,
173  const Point & aCenter,
174  UnsignedInteger aRadius );
175 
185  template <typename TDigitalSet>
186  static void removeNorm1Ball( TDigitalSet & aSet,
187  const Point & aCenter,
188  UnsignedInteger aRadius );
189 
199  template <typename TDigitalSet>
200  static void removeNorm2Ball( TDigitalSet & aSet,
201  const Point & aCenter,
202  UnsignedInteger aRadius );
203 
204 
205  // ----------------------- Standard services ------------------------------
206  public:
207 
211  ~Shapes();
212 
213  // ----------------------- Interface --------------------------------------
214  public:
215 
220  void selfDisplay ( std::ostream & out ) const;
221 
226  bool isValid() const;
227 
228  // ------------------------- Protected Datas ------------------------------
229  private:
230  // ------------------------- Private Datas --------------------------------
231  private:
232 
233  // ------------------------- Hidden services ------------------------------
234  protected:
235 
240  Shapes();
241 
242  private:
243 
249  Shapes ( const Shapes & other );
250 
257  Shapes & operator= ( const Shapes & other );
258 
259  // ------------------------- Internals ------------------------------------
260  private:
261 
262  }; // end of class Shapes
263 
264 
271  template <typename TDomain>
272  std::ostream&
273  operator<< ( std::ostream & out, const Shapes<TDomain> & object );
274 
275 } // namespace DGtal
276 
277 
279 // Includes inline functions.
280 #include "DGtal/shapes/Shapes.ih"
281 
282 // //
284 
285 #endif // !defined Shapes_h
286 
287 #undef Shapes_RECURSES
288 #endif // else defined(Shapes_RECURSES)