DGtal  0.9.2
RegularPointEmbedder.h
1 
17 #pragma once
18 
33 #if defined(RegularPointEmbedder_RECURSES)
34 #error Recursive header files inclusion detected in RegularPointEmbedder.h
35 #else // defined(RegularPointEmbedder_RECURSES)
36 
37 #define RegularPointEmbedder_RECURSES
38 
39 #if !defined RegularPointEmbedder_h
40 
41 #define RegularPointEmbedder_h
42 
44 // Inclusions
45 #include <iostream>
46 #include "DGtal/base/Common.h"
47 #include "DGtal/kernel/CSpace.h"
48 
50 
51 namespace DGtal
52 {
53 
55  // template class RegularPointEmbedder
67  template <typename TSpace>
69  {
71 
72  // ----------------------- Standard services ------------------------------
73  public:
74  typedef TSpace Space;
75  typedef typename Space::Point Point;
76  typedef typename Space::RealPoint RealPoint;
77  typedef Point Argument;
78  typedef RealPoint Value;
79 
80  typedef typename Space::Integer Integer;
81  typedef typename Space::RealVector RealVector;
82 
87 
92 
99 
107  void init( typename RealVector::Component gridStep );
108 
115  void init( const RealVector & gridSteps );
116 
121  Point floor( const RealPoint & p ) const;
122 
127  Point ceil( const RealPoint & p ) const;
128 
135  Point round( const RealPoint & p ) const;
136 
144  RealPoint embed( const Point & p ) const;
145 
153  RealPoint operator()( const Point & p ) const;
154 
155 
159  RealVector gridSteps() const;
160 
161 
162  // ----------------------- Interface --------------------------------------
163  public:
164 
169  void selfDisplay ( std::ostream & out ) const;
170 
175  bool isValid() const;
176 
177  // ------------------------- Protected Datas ------------------------------
178  protected:
180  RealVector myGridSteps;
181 
182  // ------------------------- Private Datas --------------------------------
183  private:
184 
185  // ------------------------- Hidden services ------------------------------
186  private:
187 
188  // ------------------------- Internals ------------------------------------
189  private:
190 
191  }; // end of class RegularPointEmbedder
192 
193 
200  template <typename TSpace>
201  std::ostream&
202  operator<< ( std::ostream & out,
203  const RegularPointEmbedder<TSpace> & object );
204 
205 } // namespace DGtal
206 
207 
209 // Includes inline functions.
210 #include "DGtal/kernel/RegularPointEmbedder.ih"
211 
212 // //
214 
215 #endif // !defined RegularPointEmbedder_h
216 
217 #undef RegularPointEmbedder_RECURSES
218 #endif // else defined(RegularPointEmbedder_RECURSES)
Point round(const RealPoint &p) const
void init(typename RealVector::Component gridStep)
RealPoint embed(const Point &p) const
Point ceil(const RealPoint &p) const
RealVector myGridSteps
The grid steps.
void selfDisplay(std::ostream &out) const
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines...
Definition: CSpace.h:105
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Point floor(const RealPoint &p) const
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
DGtal is the top-level namespace which contains all DGtal functions and types.
RegularPointEmbedder & operator=(const RegularPointEmbedder &other)
Aim: A simple point embedder where grid steps are given for each axis. Note that the real point (0...
RealPoint operator()(const Point &p) const
RealVector gridSteps() const
TEuclideanRing Component
Type for Vector elements.
Definition: PointVector.h:155