DGtal  1.2.0
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)
35 #define Shapes_RECURSES
36 
37 #if !defined Shapes_h
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;
81  typedef typename Domain::Point Point;
82  typedef typename Domain::Vector Vector;
83  typedef typename Domain::Predicate Predicate;
85  //Arithmetic
86  typedef typename Space::Integer Integer;
88 
89  // ----------------------- Static services ------------------------------
90  public:
91 
104  template <typename TDigitalSet, typename TShapeFunctor>
105  static void digitalShaper( TDigitalSet & aSet,
106  const TShapeFunctor & aFunctor);
107 
123  template <typename TDigitalSet, typename TShapeFunctor>
124  static void euclideanShaper( TDigitalSet & aSet,
125  const TShapeFunctor & aFunctor,
126  const double h = 1.0);
127 
141  template < typename DigitalSet, typename PointPredicate >
142  static
143  void makeSetFromPointPredicate( DigitalSet & aSet,
144  const PointPredicate & aPP );
145 
146 
157  template<typename TDigitalSet>
158  static void addNorm1Ball( TDigitalSet & aSet,
159  const Point & aCenter,
160  UnsignedInteger aRadius );
161 
172  template <typename TDigitalSet>
173  static void addNorm2Ball( TDigitalSet & aSet,
174  const Point & aCenter,
175  UnsignedInteger aRadius );
176 
186  template <typename TDigitalSet>
187  static void removeNorm1Ball( TDigitalSet & aSet,
188  const Point & aCenter,
189  UnsignedInteger aRadius );
190 
200  template <typename TDigitalSet>
201  static void removeNorm2Ball( TDigitalSet & aSet,
202  const Point & aCenter,
203  UnsignedInteger aRadius );
204 
205 
206  // ----------------------- Standard services ------------------------------
207  public:
208 
213 
214  // ----------------------- Interface --------------------------------------
215  public:
216 
221  void selfDisplay ( std::ostream & out ) const;
222 
227  bool isValid() const;
228 
229  // ------------------------- Protected Datas ------------------------------
230  private:
231  // ------------------------- Private Datas --------------------------------
232  private:
233 
234  // ------------------------- Hidden services ------------------------------
235  protected:
236 
242 
243  private:
244 
250  Shapes ( const Shapes & other );
251 
258  Shapes & operator= ( const Shapes & other );
259 
260  // ------------------------- Internals ------------------------------------
261  private:
262 
263  }; // end of class Shapes
264 
265 
272  template <typename TDomain>
273  std::ostream&
274  operator<< ( std::ostream & out, const Shapes<TDomain> & object );
275 
276 } // namespace DGtal
277 
278 
280 // Includes inline functions.
281 #include "DGtal/shapes/Shapes.ih"
282 
283 // //
285 
286 #endif // !defined Shapes_h
287 
288 #undef Shapes_RECURSES
289 #endif // else defined(Shapes_RECURSES)
Iterator for HyperRectDomain.
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
Shapes & operator=(const Shapes &other)
Space::Integer Integer
Domain::Space::RealPoint RealPoint
Domain::Predicate Predicate
static void addNorm1Ball(TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius)
Domain::Space Space
static void makeSetFromPointPredicate(DigitalSet &aSet, const PointPredicate &aPP)
static void removeNorm1Ball(TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius)
Space::UnsignedInteger UnsignedInteger
static void euclideanShaper(TDigitalSet &aSet, const TShapeFunctor &aFunctor, const double h=1.0)
Domain::Vector Vector
BOOST_CONCEPT_ASSERT((concepts::CDomain< TDomain >))
void selfDisplay(std::ostream &out) const
static void addNorm2Ball(TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius)
Shapes(const Shapes &other)
static void removeNorm2Ball(TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius)
Domain::ConstIterator ConstIterator
static void digitalShaper(TDigitalSet &aSet, const TShapeFunctor &aFunctor)
Domain::Point Point
bool isValid() const
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
NumberTraits< Integer >::UnsignedVersion UnsignedInteger
Unsigned version of the Integers.
Definition: SpaceND.h:104
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition: CDomain.h:130
Z2i::RealPoint RealPoint