00001 #ifndef __REGGRID__
00002 #define __REGGRID__
00003
00004 #include "cml/cml.h"
00005 #include <vector>
00006
00007 #include "streamline.h"
00008
00009 using std::vector;
00010
00031 class Reggrid
00032 {
00033
00034 public:
00035 float m_separatingDistance;
00036 float m_testingDistance;
00037
00038 float m_width;
00039 float m_height;
00040
00041 int m_cellsX;
00042 int m_cellsY;
00043
00044 vector<cml::vector2f> *m_grid;
00045
00046 bool TestCollision(const cml::vector2f &point, float distance) const;
00047 public:
00048 Reggrid(float width, float height, float separatingDistance, float testingDistance);
00049
00050 const vector<cml::vector2f> &GetCell(int cellId) const;
00051 vector<cml::vector2f> &GetCell(int cellId);
00052
00053 bool Collides(const cml::vector2f &point) const;
00054 bool SeedCollides(const cml::vector2f &point) const;
00055
00056 float GetTaperingSize(const cml::vector2f &point) const;
00057
00058 bool AreCoordsValid(int x, int y) const;
00059 bool AreCoordsValid(const cml::vector2f &point) const {return AreCoordsValid(point[0], point[1]);}
00060
00061 void GetCoordsFromID(int cellId, int &x, int &y) const;
00062 int GetCellIDFromCoords(float x, float y) const;
00063 int GetCellIDFromCellCoords(int x, int y) const;
00064
00065 void AddPoint(const cml::vector2f &point);
00066 };
00067
00068
00069 #endif