00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __TLSPIRAL_H__
00018 #define __TLSPIRAL_H__
00019
00020
00021 #include "tlVision.h"
00022
00023 #include "tlPoint.h"
00024
00025
00026
00027 class tlSpiral
00028 {
00029 private:
00030 int x0,y0;
00031 int x,y;
00032 int nextX, nextY;
00033 int lastX, lastY;
00034 int width, height;
00035 int minX,maxX,minY,maxY;
00036 int done;
00037 int condX;
00038 int condY;
00039 int cur_incr;
00040 int x_incr;
00041 int y_incr;
00042
00043
00044 public:
00045
00046
00047 tlSpiral (tlRect *rect = NULL);
00048 tlSpiral (int x0, int y0, int width, int height, tlRect *rect = NULL);
00049 tlSpiral (tlPoint *p0, int width, int height, tlRect *rect = NULL);
00050 virtual ~tlSpiral ();
00051
00052
00053 int init (int x0, int y0, int width, int height, tlRect *rect = NULL);
00054 int init (tlPoint *p0, int width, int height, tlRect *rect = NULL);
00055
00056
00057 int toNext ();
00058 int toNext (tlPoint *point);
00059
00060
00061 tlPoint *get () { return new tlPoint (x,y); };
00062 int get (tlPoint *point) { return point->setLocation (x,y); }
00063 int getX () { return x; };
00064 int getY () { return y; };
00065 int getIndex () { return y*width+x; };
00066
00067
00068 tlPoint *getLast () { return new tlPoint (lastX, lastY); };
00069 int getLast (tlPoint *point) { return point->setLocation (lastX, lastY); };
00070 int getLastX () { return lastX; };
00071 int getLastY () { return lastY; };
00072 int getLastIndex () { return lastY*width+lastX; };
00073
00074
00075 tlPoint *getNext () { return new tlPoint (nextX, nextY); };
00076 int getNext (tlPoint *point) { return point->setLocation (nextX, nextY); };
00077 int getNextX () { return nextX; };
00078 int getNextY () { return nextY; };
00079 int getNextIndex () { return nextY*width+nextX; };
00080
00081 };
00082
00083
00084 #endif
00085