DGtal 1.3.0
Loading...
Searching...
No Matches
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)
35#define CurveDigitizer_RECURSES
36
37#if !defined CurveDigitizer_h
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
52namespace DGtal
53{
54
56// class NaiveParametricCurveDigitizer3D
71template <typename TParametricCurve>
73{
74 BOOST_CONCEPT_ASSERT(( concepts::C3DParametricCurve < TParametricCurve > ));
75 // ----------------------- Standard services ------------------------------
76public:
78 typedef typename TParametricCurve::Space::Point Point;
80 typedef typename TParametricCurve::Space::RealPoint RealPoint;
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 --------------------------------------
119public:
120
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 --------------------------------
165private:
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 ------------------------------
201protected:
209 const TParametricCurve * curve;
211 long double step;
213 long double timeMin;
215 long double timeMax;
217 bool initOK;
218
219 // ------------------------- Hidden services ------------------------------
220private:
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
264
265
266
267 // ------------------------- Internals ------------------------------------
268
269}; // end of class CurveDigitizer
270
271
278template <typename T>
279std::ostream&
280operator<< ( 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)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Aim: Digitization of 3D parametric curves. This method produces, for good parameters step and k_next,...
void attach(ConstAlias< TParametricCurve > p_curve)
unsigned int setKNext(unsigned int knext)
void syncData(ConstIterator bbegin, ConstIterator bend, DataInfo &weights)
NaiveParametricCurveDigitizer3D & operator=(const NaiveParametricCurveDigitizer3D &other)=delete
long double timeMin
starting time (has to be lower than timeMax)
void selfDisplay(std::ostream &out) const
std::vector< std::pair< long double, unsigned int > > MetaData
DigitalCurve digitalCurve
A storage of final integer points.
void digitize(std::back_insert_iterator< DigitalCurve > inserter)
void flashBuffers(Buffer &buffer, DataInfo &weights)
bool metaData
A flag used to decided if meta data should be stored and returned to the user.
NaiveParametricCurveDigitizer3D(const NaiveParametricCurveDigitizer3D &other)=delete
TParametricCurve::Space::RealPoint RealPoint
Real point type.
long double timeMax
the time when the digitization should stop (has to be bigger than timeMin)
const TParametricCurve * curve
A pointer to the parameteric curve which is going to be digitized.
void digitize(std::back_insert_iterator< DigitalCurve > inserter, std::back_insert_iterator< MetaData > meta_inserter)
std::map< Point, std::pair< long double, unsigned int > > DataInfo
void init(long double tmin, long double tmax, long double timeStep)
void updateMetaData(const Point &p, const RealPoint &pc, DataInfo &weights, long double t)
std::vector< Point > DigitalCurve
Digital curve type.
MetaData metaDataContainter
A storage of final meta data (if requested)
BOOST_CONCEPT_ASSERT((concepts::C3DParametricCurve< TParametricCurve >))
bool is26Connected(const Point &x, const Point &y)
bool initOK
A flag which is set to true if the initial paramters are correct.
TParametricCurve::Space::Point Point
Integer point type.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
A structure used for making iterations over digital curve with respect to K_NEXT.
A structure used for making iterations over digital curve with respect to K_NEXT.