libmove3d
3.13.0
|
00001 #ifndef __DPGGRID_H__ 00002 #define __DPGGRID_H__ 00003 #include "Planner-pkg.h" 00004 #include "P3d-pkg.h" 00005 #include "DpgCell.h" 00006 #include <vector> 00007 00008 class DpgGrid { 00009 public: 00010 //constructors and destructors 00011 DpgGrid(p3d_env* env); 00012 virtual ~DpgGrid(); 00013 00014 //setters and getters 00015 inline int getNbCells(void){return _nbCells;} 00016 inline int getNbCellsOverX(void){return _nbCellsX;} 00017 inline int getNbCellsOverY(void){return _nbCellsY;} 00018 inline int getNbCellsOverZ(void){return _nbCellsZ;} 00019 00020 //functions 00021 inline DpgCell* getCellAt(int x, int y, int z); 00022 //1 = vers les positifs, -1 = vers les negatifs, 0 retourner toutes les cellules 00023 std::vector<DpgCell*> getCellPoint(double *point, int dx, int dy, int dz); 00024 void init(void); 00025 std::vector<DpgCell*> getCellListForObject(p3d_obj* obj); 00026 void unvalidObjectCells(p3d_obj* obj); 00027 protected: 00028 void getCellListForEdge(p3d_polyhedre * poly, int edgeId, std::vector<DpgCell*>& edgeCells); 00029 void getCellForProjectedEdge(double * point1, double * point2, std::vector<DpgCell*>& edgeCells); 00030 private: 00031 p3d_env* _env; 00032 double _cellSize; 00033 //The position of the origin of the grid regarding th eorigin of the world 00034 double _originPos[3]; 00035 int _nbMaxCells; //the number of cell along the longest axis of the environment 00036 int _nbCells; 00037 int _nbCellsX; 00038 int _nbCellsY; 00039 int _nbCellsZ; 00040 std::vector<DpgCell*> _cells; 00041 }; 00042 00043 #endif