DGtal  1.3.beta
NaiveParametricCurveDigitizer3D.h
1 
17 #pragma once
18 
31 #if defined(CurveDigitizer_RECURSES)
32 #error Recursive header files inclusion detected in CurveDigitizer.h
33 #else // defined(CurveDigitizer_RECURSES)
34 
35 #define CurveDigitizer_RECURSES
36 
37 #if !defined CurveDigitizer_h
38 
39 #define CurveDigitizer_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/helpers/StdDefs.h"
45 #include "DGtal/base/Common.h"
46 #include <vector>
47 #include <map>
48 #include <iterator>
49 #include "DGtal/geometry/curves/parametric/C3DParametricCurve.h"
51 
52 namespace DGtal
53 {
54 
56 // class NaiveParametricCurveDigitizer3D
71 template <typename TParametricCurve>
73 {
75  // ----------------------- Standard services ------------------------------
76 public:
82  typedef std::vector<Point> DigitalCurve;
89  typedef std::vector< std::pair < long double, unsigned int > > MetaData;
90 
95 
100 
101 
108 
109 
117 
118  // ----------------------- Interface --------------------------------------
119 public:
120 
124  void attach ( ConstAlias<TParametricCurve> p_curve );
125 
131  void init ( long double tmin, long double tmax, long double timeStep );
132 
137  unsigned int setKNext ( unsigned int knext );
138 
139 
143  void digitize ( std::back_insert_iterator < DigitalCurve > inserter );
144 
150  void digitize ( std::back_insert_iterator < DigitalCurve > inserter, std::back_insert_iterator < MetaData > meta_inserter );
151 
156  void selfDisplay ( std::ostream & out ) const;
157 
162  bool isValid() const;
163 
164  // ------------------------- Private Data --------------------------------
165 private:
166 
172 
176  typedef typename Buffer::const_iterator ConstIterator;
177 
182  typedef std::map < Point, std::pair < long double, unsigned int > > DataInfo;
183 
188  unsigned int K_NEXT;
189 
193  unsigned int BUFFER_SIZE;
194 
196  struct KConstIter { typename DigitalCurve::const_iterator jt; unsigned int k; };
198  struct KIter { typename DigitalCurve::iterator jt; unsigned int k; };
199 
200  // ------------------------- Protected Data ------------------------------
201 protected:
207  bool metaData;
209  const TParametricCurve * curve;
211  long double step;
213  long double timeMin;
215  long double timeMax;
217  bool initOK;
218 
219  // ------------------------- Hidden services ------------------------------
220 private:
221 
228  bool is26Connected ( const Point &x, const Point &y );
235  void syncData ( ConstIterator bbegin, ConstIterator bend, DataInfo & weights );
236 
243  void flashBuffers ( Buffer & buffer, DataInfo & weights );
244 
253  void updateMetaData ( const Point & p, const RealPoint & pc, DataInfo & weights, long double t );
254 
258  void cleanCurve ( );
259 
263  void cleanClosedPart ( );
264 
265 
266 
267  // ------------------------- Internals ------------------------------------
268 
269 }; // end of class CurveDigitizer
270 
271 
278 template <typename T>
279 std::ostream&
280 operator<< ( std::ostream & out, const NaiveParametricCurveDigitizer3D<T> & object );
281 
282 
283 } // namespace DGtal
284 
285 
287 // Includes inline functions.
288 #if !defined(BUILD_INLINE)
289 #include "DGtal/geometry/curves/parametric/NaiveParametricCurveDigitizer3D.ih"
290 #endif
291 
292 
293 // //
295 
296 #endif // !defined CurveDigitizer_h
297 
298 #undef CurveDigitizer_RECURSES
299 #endif // else defined(CurveDigitizer_RECURSES)
DGtal::NaiveParametricCurveDigitizer3D::setKNext
unsigned int setKNext(unsigned int knext)
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DGtal::NaiveParametricCurveDigitizer3D::metaDataContainter
MetaData metaDataContainter
A storage of final meta data (if requested)
Definition: NaiveParametricCurveDigitizer3D.h:205
DGtal::NaiveParametricCurveDigitizer3D::metaData
bool metaData
A flag used to decided if meta data should be stored and returned to the user.
Definition: NaiveParametricCurveDigitizer3D.h:207
DGtal::NaiveParametricCurveDigitizer3D::cleanClosedPart
void cleanClosedPart()
DGtal::NaiveParametricCurveDigitizer3D::K_NEXT
unsigned int K_NEXT
Definition: NaiveParametricCurveDigitizer3D.h:188
DGtal::NaiveParametricCurveDigitizer3D::flashBuffers
void flashBuffers(Buffer &buffer, DataInfo &weights)
DGtal::NaiveParametricCurveDigitizer3D::DigitalCurve
std::vector< Point > DigitalCurve
Digital curve type.
Definition: NaiveParametricCurveDigitizer3D.h:82
DGtal::NaiveParametricCurveDigitizer3D::KConstIter::k
unsigned int k
Definition: NaiveParametricCurveDigitizer3D.h:196
DGtal::concepts::C3DParametricCurve
Aim:
Definition: C3DParametricCurve.h:87
DGtal::NaiveParametricCurveDigitizer3D::is26Connected
bool is26Connected(const Point &x, const Point &y)
DGtal::NaiveParametricCurveDigitizer3D::KConstIter
A structure used for making iterations over digital curve with respect to K_NEXT.
Definition: NaiveParametricCurveDigitizer3D.h:196
DGtal::NaiveParametricCurveDigitizer3D::Point
TParametricCurve::Space::Point Point
Integer point type.
Definition: NaiveParametricCurveDigitizer3D.h:78
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::NaiveParametricCurveDigitizer3D::Buffer
DigitalCurve Buffer
Definition: NaiveParametricCurveDigitizer3D.h:171
DGtal::NaiveParametricCurveDigitizer3D::KConstIter::jt
DigitalCurve::const_iterator jt
Definition: NaiveParametricCurveDigitizer3D.h:196
DGtal::NaiveParametricCurveDigitizer3D::curve
const TParametricCurve * curve
A pointer to the parameteric curve which is going to be digitized.
Definition: NaiveParametricCurveDigitizer3D.h:209
DGtal::NaiveParametricCurveDigitizer3D::timeMax
long double timeMax
the time when the digitization should stop (has to be bigger than timeMin)
Definition: NaiveParametricCurveDigitizer3D.h:215
DGtal::NaiveParametricCurveDigitizer3D::isValid
bool isValid() const
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::NaiveParametricCurveDigitizer3D::~NaiveParametricCurveDigitizer3D
~NaiveParametricCurveDigitizer3D()=default
DGtal::NaiveParametricCurveDigitizer3D::init
void init(long double tmin, long double tmax, long double timeStep)
DGtal::NaiveParametricCurveDigitizer3D::digitalCurve
DigitalCurve digitalCurve
A storage of final integer points.
Definition: NaiveParametricCurveDigitizer3D.h:203
DGtal::NaiveParametricCurveDigitizer3D::cleanCurve
void cleanCurve()
DGtal::NaiveParametricCurveDigitizer3D::MetaData
std::vector< std::pair< long double, unsigned int > > MetaData
Definition: NaiveParametricCurveDigitizer3D.h:89
DGtal::NaiveParametricCurveDigitizer3D::operator=
NaiveParametricCurveDigitizer3D & operator=(const NaiveParametricCurveDigitizer3D &other)=delete
DGtal::NaiveParametricCurveDigitizer3D
Aim: Digitization of 3D parametric curves. This method produces, for good parameters step and k_next,...
Definition: NaiveParametricCurveDigitizer3D.h:72
DGtal::NaiveParametricCurveDigitizer3D::KIter
A structure used for making iterations over digital curve with respect to K_NEXT.
Definition: NaiveParametricCurveDigitizer3D.h:198
DGtal::NaiveParametricCurveDigitizer3D::NaiveParametricCurveDigitizer3D
NaiveParametricCurveDigitizer3D()
DGtal::NaiveParametricCurveDigitizer3D::step
long double step
the time step value
Definition: NaiveParametricCurveDigitizer3D.h:211
DGtal::NaiveParametricCurveDigitizer3D::KIter::k
unsigned int k
Definition: NaiveParametricCurveDigitizer3D.h:198
DGtal::NaiveParametricCurveDigitizer3D::attach
void attach(ConstAlias< TParametricCurve > p_curve)
DGtal::NaiveParametricCurveDigitizer3D::updateMetaData
void updateMetaData(const Point &p, const RealPoint &pc, DataInfo &weights, long double t)
DGtal::NaiveParametricCurveDigitizer3D::ConstIterator
Buffer::const_iterator ConstIterator
Definition: NaiveParametricCurveDigitizer3D.h:176
DGtal::NaiveParametricCurveDigitizer3D::digitize
void digitize(std::back_insert_iterator< DigitalCurve > inserter)
DGtal::NaiveParametricCurveDigitizer3D::BUFFER_SIZE
unsigned int BUFFER_SIZE
Definition: NaiveParametricCurveDigitizer3D.h:193
DGtal::NaiveParametricCurveDigitizer3D::syncData
void syncData(ConstIterator bbegin, ConstIterator bend, DataInfo &weights)
DGtal::NaiveParametricCurveDigitizer3D::initOK
bool initOK
A flag which is set to true if the initial paramters are correct.
Definition: NaiveParametricCurveDigitizer3D.h:217
DGtal::NaiveParametricCurveDigitizer3D::KIter::jt
DigitalCurve::iterator jt
Definition: NaiveParametricCurveDigitizer3D.h:198
DGtal::NaiveParametricCurveDigitizer3D::RealPoint
TParametricCurve::Space::RealPoint RealPoint
Real point type.
Definition: NaiveParametricCurveDigitizer3D.h:80
Point
MyPointD Point
Definition: testClone2.cpp:383
RealPoint
Z2i::RealPoint RealPoint
Definition: testAstroid2D.cpp:46
DGtal::NaiveParametricCurveDigitizer3D::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::NaiveParametricCurveDigitizer3D::DataInfo
std::map< Point, std::pair< long double, unsigned int > > DataInfo
Definition: NaiveParametricCurveDigitizer3D.h:182
DGtal::NaiveParametricCurveDigitizer3D::timeMin
long double timeMin
starting time (has to be lower than timeMax)
Definition: NaiveParametricCurveDigitizer3D.h:213
DGtal::NaiveParametricCurveDigitizer3D::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::C3DParametricCurve< TParametricCurve >))