26 #ifndef __Bresenham_hh__
27 #define __Bresenham_hh__
29 #include <bias_config.h>
32 #include <Base/ImageUtils/EightWaySymmetry.hh>
46 inline Bresenham(
const int start[2],
const int end[2]);
48 inline Bresenham(
const unsigned int start[2],
const unsigned int end[2]);
50 inline Bresenham(
const double start[2],
const double end[2]);
54 inline void Init(
const int start[2],
const int end[2]);
56 inline void Init(
const unsigned int start[2],
const unsigned int end[2])
57 {
Init((
int *)start, (
int *)end); };
59 inline void Init(
const double start[2],
const double end[2]);
61 inline bool GetNext(
int next[2]);
64 {
return GetNext((
int *)next); };
66 inline bool GetNext(
double next[2]);
150 double transfstart[2] = { 0.0, 0.0 };
153 _iStart[0]=(int)rint(start[0]);
154 _iStart[1]=(int)rint(start[1]);
155 _iEnd[0]=(int)rint(end[0]);
156 _iEnd[1]=(int)rint(end[1]);
169 _dDx=(double)_iTransformedStart[0]-transfstart[0];
170 _dDy=(double)_iTransformedStart[1]-transfstart[1];
189 BIASERR(
"call Init befor GetNext");
218 next[0]=(double)inext[0] +
_dDx;
219 next[1]=(double)inext[1] +
_dDy;
227 #endif // __Bresenham_hh__
void InverseTransform(enum TLineType &type, const T &Transformedx, const T &Transformedy, T &Originalx, T &Originaly)
executes the inverse transformation to the above
int _iTransformedCurrent[2]
enum TLineType DetermineLineType(double &angle)
assumes angle is between (-pi, pi] as given by atan2
EightWaySymmetry< int > _iSym
bool GetNext(unsigned int next[2])
void Init(const unsigned int start[2], const unsigned int end[2])
bool GetNext(int next[2])
int _iTransformedStart[2]
void Transform(enum TLineType &type, const T &Originalx, const T &Originaly, T &Transformedx, T &Transformedy)
transforms Original according to type in a way that Transformed lies on a line with slope in [0...
Scans a line using Bresenhams integer arithmetic algorithm.
enum TLineType _eLineType
void Init(const int start[2], const int end[2])
TLineType
direction of line if start is in coordinate origin as given by compass