00001
00029 #ifndef errorfreeCSED_h
00030 #define errorfreeCSED_h
00031
00032 #include "DistanceTransform.h"
00033 #include <iostream>
00034 using namespace std;
00035
00044 class errorfreeCSED : public DistanceTransform {
00045
00046 public:
00047 errorfreeCSED ( const int xSize, const int ySize, const bool unload=true )
00048 : DistanceTransform(xSize, ySize, unload)
00049 {
00050 }
00051
00052 void doTransform ( const unsigned char* const I );
00053
00061 virtual inline bool getP ( const int x, const int y, int& px, int& py )
00062 const {
00063 if (v==NULL) {
00064 px = py = -1;
00065 return false;
00066 }
00067 const int s = sub(x,y);
00068 px = x - v[s].x;
00069 py = y - v[s].y;
00070 return true;
00071 }
00072
00073 protected:
00074 P* v;
00075
00076 private:
00077 inline void test ( const int px, const int py, const int ox, const int oy,
00078 vector<P*>* list2, const int i );
00079
00080 static inline double D ( const int x, const int y ) {
00081
00082 return sqrt( (double)x * x + y * y );
00083 }
00084
00085 static inline double D ( P& p ) {
00086
00087 return sqrt( (double)p.x * p.x + p.y * p.y );
00088 }
00089 };
00090
00091 #endif
00092
00093