// AABH.h // Header file for the AABB class // Dynamic Array used to store the co-ordinates of the bounding boxes used for // collsion detection. The array is only used initially before being copied // into AABB Linked Lists. The array is then terminated. // // I created this class originally before using linked lists to store the BB // info. But decided to keep it has the stored data can be easily copied across // into different linked lists in any prefered order. (i.e. the data is copied // into across into linked lists for different quadrants) // // Shay Leary, March 2005 //-------------------------------------------------------------------------------------- #ifndef AABB_H #define AABB_H //-------------------------------------------------------------------------------------- #include "../glIncludes.h" #include <cmath> #include <iostream> #include <vector> //-------------------------------------------------------------------------------------- class AABB { private: // stores x,y,z co-ordinates struct XYZ { GLdouble x, y, z; }; // stores max and min values of co-ordinates struct BoundingBox { XYZ max; XYZ min; }; // dynamic array to store info std::vector<BoundingBox> m_BBox; //---------------------------------------------------------------------------------- public: AABB() = default; //---------------------------------------------------------------------------------- // Set Methods //---------------------------------------------------------------------------------- void SetMaxX(const int& tempIndex, const GLdouble& tempX); void SetMinX(const int& tempIndex, const GLdouble& tempX); void SetMaxY(const int& tempIndex, const GLdouble& tempY); void SetMinY(const int& tempIndex, const GLdouble& tempY); void SetMaxZ(const int& tempIndex, const GLdouble& tempZ); void SetMinZ(const int& tempIndex, const GLdouble& tempZ); void AddBoundingBox(); //---------------------------------------------------------------------------------- // Get Methods //---------------------------------------------------------------------------------- GLdouble GetMaxX(const int& tempIndex) const; GLdouble GetMinX(const int& tempIndex) const; GLdouble GetMaxY(const int& tempIndex) const; GLdouble GetMinY(const int& tempIndex) const; GLdouble GetMaxZ(const int& tempIndex) const; GLdouble GetMinZ(const int& tempIndex) const; size_t GetNoBoundingBoxes() const; void clear(); }; #endif //--------------------------------------------------------------------------------------