DGtal  1.0.0
GaussDigitizer.h
1 
17 #pragma once
18 
34 #if defined(GaussDigitizer_RECURSES)
35 #error Recursive header files inclusion detected in GaussDigitizer.h
36 #else // defined(GaussDigitizer_RECURSES)
37 
38 #define GaussDigitizer_RECURSES
39 
40 #if !defined GaussDigitizer_h
41 
42 #define GaussDigitizer_h
43 
45 // Inclusions
46 #include <iostream>
47 #include "DGtal/base/Common.h"
48 #include "DGtal/base/ConstAlias.h"
49 #include "DGtal/base/CountedConstPtrOrConstPtr.h"
50 #include "DGtal/kernel/domains/HyperRectDomain.h"
51 #include "DGtal/kernel/RegularPointEmbedder.h"
52 #include "DGtal/shapes/CEuclideanOrientedShape.h"
53 #include "DGtal/shapes/CEuclideanBoundedShape.h"
54 
56 
57 namespace DGtal
58 {
59 
61  // template class GaussDigitizer
78  template <typename TSpace, typename TEuclideanShape>
80  {
81  // ----------------------- Standard services ------------------------------
82  public:
83  typedef TSpace Space;
84  typedef typename Space::Integer Integer;
85  typedef typename Space::Point Point;
86  typedef typename Space::Vector Vector;
87  typedef typename Space::RealPoint RealPoint;
88  typedef typename Space::RealPoint RealVector;
89  typedef TEuclideanShape EuclideanShape;
92 
94 
99 
103  GaussDigitizer();
104 
110  GaussDigitizer & operator= ( const GaussDigitizer & other );
111 
115  void attach( ConstAlias<EuclideanShape> shape );
116 
129  void init( const RealPoint & xLow, const RealPoint & xUp,
130  typename RealVector::Component gridStep );
131 
143  void init( const RealPoint & xLow, const RealPoint & xUp,
144  const RealVector & gridSteps );
145 
149  const PointEmbedder & pointEmbedder() const;
150 
155  Domain getDomain() const;
156 
161  Point floor( const RealPoint & p ) const;
162 
167  Point ceil( const RealPoint & p ) const;
168 
175  Point round( const RealPoint & p ) const;
176 
184  RealPoint embed( const Point & p ) const;
185 
194  Orientation orientation(const Point &p) const
195  {
196  return myEShape->orientation(embed(p));
197  }
198 
205  bool operator()( const Point & p ) const;
206 
211  const Point & getLowerBound() const;
212 
217  const Point & getUpperBound() const;
218 
222  Vector resolution() const;
223 
227  RealVector gridSteps() const;
228 
229 
230  // ----------------------- Interface --------------------------------------
231  public:
232 
237  void selfDisplay ( std::ostream & out ) const;
238 
243  bool isValid() const;
244 
245  // ------------------------- Protected Datas ------------------------------
246  protected:
249 
252 
255 
258  // ------------------------- Private Datas --------------------------------
259  private:
260 
261  // ------------------------- Hidden services ------------------------------
262  private:
263 
264  // ------------------------- Internals ------------------------------------
265  private:
266 
267  }; // end of class GaussDigitizer
268 
269 
276  template <typename TSpace, typename TEuclideanShape>
277  std::ostream&
278  operator<< ( std::ostream & out,
280 
281 } // namespace DGtal
282 
283 
285 // Includes inline functions.
286 #include "DGtal/shapes/GaussDigitizer.ih"
287 
288 // //
290 
291 #endif // !defined GaussDigitizer_h
292 
293 #undef GaussDigitizer_RECURSES
294 #endif // else defined(GaussDigitizer_RECURSES)
Space::RealPoint RealPoint
Point myLowerPoint
Digital lowest point.
bool isValid() const
const Point & getLowerBound() const
void selfDisplay(std::ostream &out) const
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
const Point & getUpperBound() const
void attach(ConstAlias< EuclideanShape > shape)
RegularPointEmbedder< Space > myPointEmbedder
The embedder.
Orientation orientation(const Point &p) const
Point ceil(const RealPoint &p) const
Orientation
Definition: Common.h:132
HyperRectDomain< Space > Domain
const PointEmbedder & pointEmbedder() const
TEuclideanShape EuclideanShape
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
Point floor(const RealPoint &p) const
Aim: characterizes models of digital oriented shapes. For example, models should provide an orientati...
DGtal is the top-level namespace which contains all DGtal functions and types.
MyPointD Point
Definition: testClone2.cpp:383
Point myUpperPoint
Digital uppest point.
bool operator()(const Point &p) const
RealPoint embed(const Point &p) const
FreemanChain< int >::Vector Vector
Point round(const RealPoint &p) const
RegularPointEmbedder< Space > PointEmbedder
RealVector gridSteps() const
BOOST_CONCEPT_ASSERT((concepts::CEuclideanOrientedShape< TEuclideanShape >))
CountedConstPtrOrConstPtr< EuclideanShape > myEShape
The referenced shape or 0 if not initialized.
Space::Integer Integer
Domain getDomain() const
Space::RealPoint RealVector
GaussDigitizer & operator=(const GaussDigitizer &other)
Vector resolution() const
TEuclideanRing Component
Type for Vector elements.
Definition: PointVector.h:614
Space::Vector Vector