DGtal  0.9.2
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/kernel/domains/HyperRectDomain.h"
49 #include "DGtal/kernel/RegularPointEmbedder.h"
50 #include "DGtal/shapes/CEuclideanOrientedShape.h"
51 #include "DGtal/shapes/CEuclideanBoundedShape.h"
52 
54 
55 namespace DGtal
56 {
57 
59  // template class GaussDigitizer
76  template <typename TSpace, typename TEuclideanShape>
78  {
79  // ----------------------- Standard services ------------------------------
80  public:
81  typedef TSpace Space;
82  typedef typename Space::Integer Integer;
83  typedef typename Space::Point Point;
84  typedef typename Space::Vector Vector;
85  typedef typename Space::RealPoint RealPoint;
86  typedef typename Space::RealPoint RealVector;
87  typedef TEuclideanShape EuclideanShape;
90 
91  // JOL: GaussDigitizer do not need a bounded shape.
92  // BOOST_CONCEPT_ASSERT(( CEuclideanBoundedShape<TEuclideanShape> ));
93 
95 
96 
100  ~GaussDigitizer();
101 
105  GaussDigitizer();
106 
112  GaussDigitizer & operator= ( const GaussDigitizer & other );
113 
117  void attach( const EuclideanShape & shape );
118 
131  void init( const RealPoint & xLow, const RealPoint & xUp,
132  typename RealVector::Component gridStep );
133 
145  void init( const RealPoint & xLow, const RealPoint & xUp,
146  const RealVector & gridSteps );
147 
151  const PointEmbedder & pointEmbedder() const;
152 
157  Domain getDomain() const;
158 
163  Point floor( const RealPoint & p ) const;
164 
169  Point ceil( const RealPoint & p ) const;
170 
177  Point round( const RealPoint & p ) const;
178 
186  RealPoint embed( const Point & p ) const;
187 
196  Orientation orientation(const Point &p) const
197  {
198  return myEShape->orientation(embed(p));
199  }
200 
207  bool operator()( const Point & p ) const;
208 
213  const Point & getLowerBound() const;
214 
219  const Point & getUpperBound() const;
220 
224  Vector resolution() const;
225 
229  RealVector gridSteps() const;
230 
231 
232  // ----------------------- Interface --------------------------------------
233  public:
234 
239  void selfDisplay ( std::ostream & out ) const;
240 
245  bool isValid() const;
246 
247  // ------------------------- Protected Datas ------------------------------
248  protected:
250  const EuclideanShape* myEShape;
251 
254 
257 
260  // ------------------------- Private Datas --------------------------------
261  private:
262 
263  // ------------------------- Hidden services ------------------------------
264  private:
265 
266  // ------------------------- Internals ------------------------------------
267  private:
268 
269  }; // end of class GaussDigitizer
270 
271 
278  template <typename TSpace, typename TEuclideanShape>
279  std::ostream&
280  operator<< ( std::ostream & out,
282 
283 } // namespace DGtal
284 
285 
287 // Includes inline functions.
288 #include "DGtal/shapes/GaussDigitizer.ih"
289 
290 // //
292 
293 #endif // !defined GaussDigitizer_h
294 
295 #undef GaussDigitizer_RECURSES
296 #endif // else defined(GaussDigitizer_RECURSES)
Space::RealPoint RealPoint
void selfDisplay(std::ostream &out) const
Point myLowerPoint
Digital lowest point.
const Point & getUpperBound() const
RegularPointEmbedder< Space > myPointEmbedder
The embedder.
Orientation orientation(const Point &p) const
void attach(const EuclideanShape &shape)
Orientation
Definition: Common.h:118
HyperRectDomain< Space > Domain
const EuclideanShape * myEShape
The referenced shape or 0 if not initialized.
TEuclideanShape EuclideanShape
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
bool operator()(const Point &p) const
RealPoint embed(const Point &p) const
Point floor(const RealPoint &p) const
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)
Domain getDomain() const
const PointEmbedder & pointEmbedder() const
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
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.
Point myUpperPoint
Digital uppest point.
Point ceil(const RealPoint &p) const
bool isValid() const
const Point & getLowerBound() const
RegularPointEmbedder< Space > PointEmbedder
BOOST_CONCEPT_ASSERT((concepts::CEuclideanOrientedShape< TEuclideanShape >))
Space::Integer Integer
Space::RealPoint RealVector
GaussDigitizer & operator=(const GaussDigitizer &other)
RealVector gridSteps() const
Vector resolution() const
Point round(const RealPoint &p) const
TEuclideanRing Component
Type for Vector elements.
Definition: PointVector.h:155
Space::Vector Vector