24 #include "../Utils_LIB/UHash.h"
27 #include <EASTL/fixed_list.h>
28 #include <EASTL/fixed_map.h>
38 namespace OpenSkyNet {
47 assert(bin_.
x() >= 0);
48 assert(bin_.
y() >= 0);
49 assert(bin_.
z() >= 0);
51 static_cast<Utils::uint>(bin_.
y()), static_cast<Utils::uint>(bin_.
z()));
95 #pragma warning(disable:4100) //unreferenced formal parameter
97 Grid& operator=(
const Grid& rhs_) {
return *
this; }
139 typedef eastl::fixed_map<CD::Volume*, OccupiedBinsList, 8>
OccupiedBinsMap;
171 void cullObjectOutside(
int& minBinX_,
int& maxBinX_,
int& minBinY_,
int& maxBinY_,
int& minBinZ_,
int& maxBinZ_)
const;
219 virtual bool calcOccupiedBins(
CD::Volume* vol_,
bool calcPlanes_=
true,
bool useOctalPartitioning_=
false,
bool decrementPrevOccupiedBins_=
false);
225 virtual bool calcOccupiedBins(
bool calcPlanes_=
true,
bool useOctalPartitioning_=
false);
282 bool isObjectOutside(
const int& minBinX_,
const int& maxBinX_,
const int& minBinY_,
283 const int& maxBinY_,
const int& minBinZ_,
const int& maxBinZ_)
const;
299 std::vector<BinDir>& neighbors_,
Utils::uint numOccupants_=0,
300 bool allowDiagonals_=
false,
bool allowCorners_=
false)
const;
313 #define MAX_GLOBAL_GRID_SUBDIVISIONS 2
314 #if MAX_GLOBAL_GRID_SUBDIVISIONS > 0
const Utils::uint MAX_X_DIVISIONS_FOR_ALL_GRIDS
Definition: CDGrid.h:72
const Math::Point< Utils::uint > & getAxisDivs() const
Definition: CDGrid.h:238
const Utils::uint MAX_SUBDIVISIONS
Definition: CDGrid.h:112
void setCorners(const Math::Point<> *corners_)
Definition: CDGrid.cpp:95
void translateMaxCorner()
Definition: CDGrid.h:232
std::map< const Math::Point< int > *, BinOccupiersList > BinOccupiersMap
Definition: CDGrid.h:143
const Utils::uint MAX_X_DIVISIONS
Definition: CDGrid.h:115
Grid * g_initialGrid
Definition: CDGrid.cpp:18
BinOccupiersList & getOccupiers(const Math::Point< int > *bin_)
Definition: CDGrid.h:294
Utils::uint _subNum
Definition: CDGrid.h:165
void resetGrid()
Definition: CDGrid.cpp:124
void calcOccupiedBinsUsingOctalPartitioning(Volume *vol_, const Math::Point< Utils::uint > &minBin_, const Math::Point< Utils::uint > &maxBin_, const Math::Point<> &maxCenter_)
Definition: CDGrid.cpp:180
BinOccupiersMap _binOccupiers
Definition: CDGrid.h:179
T & y()
Definition: MPoint.h:65
const Math::Point ** _corners
Definition: CDGrid.h:151
static void resetAllGlobalGrids()
Definition: CDGrid.cpp:115
Math::Point * _binSize
Definition: CDGrid.h:160
const Utils::uint INITIAL_Y_DIVISIONS
Definition: CDGrid.h:106
void getBin(const Math::Point<> &p_, Math::Point< int > &bin_) const
Definition: CDGrid.h:250
std::map< CD::Volume *, OccupiedBinsList > OccupiedBinsMap
Definition: CDGrid.h:144
Math::Point * _maxCorner
Definition: CDGrid.h:154
void cullObjectOutside(int &minBinX_, int &maxBinX_, int &minBinY_, int &maxBinY_, int &minBinZ_, int &maxBinZ_) const
bool decrementBin(const Math::Point< int > &bin_)
Definition: CDGrid.h:261
T & x()
Definition: MPoint.h:64
Utils::uint getCompositeKey(const Math::Point< Utils::uint > &bin_)
Definition: CDGrid.h:41
std::list< const Math::Point< int > * > OccupiedBinsList
Definition: CDGrid.h:142
Math::Point _subBinSize
Definition: CDGrid.h:167
const Math::Point & getMaxCorner() const
Definition: CDGrid.h:228
Utils::HashTableUIntKeys< unsigned short > _isBinOccupied
Definition: CDGrid.h:177
const Math::Point & getSize() const
Definition: CDGrid.h:235
DIRECTION
Definition: CDGrid.h:61
Definition: CDVolume.h:225
std::list< CD::Volume * > BinOccupiersList
Definition: CDGrid.h:141
bool _didDynamicallyAllocateMem
Definition: CDGrid.h:149
const Utils::uint INITIAL_Z_DIVISIONS
Definition: CDGrid.h:109
const Math::Point & getBinSize() const
Definition: CDGrid.h:242
#define MAX_GLOBAL_GRID_SUBDIVISIONS
Definition: CDGrid.h:313
void getOccupiedBins(std::vector< const Math::Point< int > * > &bins_) const
bool _isSub
Definition: CDGrid.h:164
void clearBin(const Math::Point< int > &bin_)
Definition: CDGrid.h:277
Grid(Utils::uint initXDivs_, Utils::uint initYDivs_, Utils::uint initZDivs_, Utils::uint maxSubdivs_)
Definition: CDGrid.cpp:28
static void shutDown()
Definition: CDGrid.cpp:85
Point< int > g_binLookupTable[MAX_X_DIVISIONS_FOR_ALL_GRIDS][MAX_Y_DIVISIONS_FOR_ALL_GRIDS][MAX_Z_DIVISIONS_FOR_ALL_GRIDS]
Definition: CDGrid.cpp:16
bool isSubdivided() const
Definition: CDGrid.h:244
static void init(Utils::uint initGlobalXDivs_, Utils::uint initGlobalYDivs_, Utils::uint initGlobalZDivs_, Utils::uint maxGlobalSubdivs_)
Definition: CDGrid.cpp:70
void makeSubGrid()
Definition: CDGrid.cpp:133
const Math::Point< int > * _bin
Definition: CDGrid.h:129
unsigned int uint
Definition: UTypes.h:39
std::set< CD::Volume * > * getNodes() const
Definition: CDGrid.h:204
T & z()
Definition: MPoint.h:66
DIRECTION _dir
Definition: CDGrid.h:130
const Utils::uint & getSubNum() const
Definition: CDGrid.h:247
Definition: PFManager.h:129
void add(const uint &key_, const T &value_)
Definition: UHash.h:185
std::set< CD::Volume * > ** _nodes
Definition: CDGrid.h:162
OccupiedBinsList & getOccupiedBins(CD::Volume *vol_)
Definition: CDGrid.h:290
OccupiedBinsMap _occupiedBins
Definition: CDGrid.h:180
virtual bool calcOccupiedBins(CD::Volume *vol_, bool calcPlanes_=true, bool useOctalPartitioning_=false, bool decrementPrevOccupiedBins_=false)
Grid * g_subdividedGrids[MAX_GLOBAL_GRID_SUBDIVISIONS]
Definition: CDGrid.cpp:20
const Utils::uint MAX_Z_DIVISIONS_FOR_ALL_GRIDS
Definition: CDGrid.h:78
const Utils::uint INITIAL_X_DIVISIONS
Definition: CDGrid.h:103
Math::Point getNearestBinCenter(const Math::Point<> &p_) const
Definition: CDGrid.cpp:609
Math::Point translatePointByBin(const Math::Point<> &p_, const Math::Point< int > &bin_) const
Definition: CDGrid.cpp:598
void setNodes(std::set< CD::Volume * > &nodes_)
Definition: CDGrid.h:202
const Utils::uint MAX_Z_DIVISIONS
Definition: CDGrid.h:121
bool isObjectOutside(const int &minBinX_, const int &maxBinX_, const int &minBinY_, const int &maxBinY_, const int &minBinZ_, const int &maxBinZ_) const
virtual ~Grid()
Definition: CDGrid.cpp:60
void getNeighbors(const Math::Point< int > &bin_, std::vector< BinDir > &neighbors_, Utils::uint numOccupants_=0, bool allowDiagonals_=false, bool allowCorners_=false) const
Definition: CDGrid.cpp:460
const Utils::uint MAX_Y_DIVISIONS_FOR_ALL_GRIDS
Definition: CDGrid.h:75
void incrementBin(const Math::Point< int > &bin_)
Definition: CDGrid.h:272
Math::Point * _size
Definition: CDGrid.h:156
const Utils::uint MAX_Y_DIVISIONS
Definition: CDGrid.h:118
Math::Point< Utils::uint > _axisDivisions
Definition: CDGrid.h:166
BinDir(const Math::Point< int > &bin_, DIRECTION dir_)
Definition: CDGrid.h:131
unsigned short getNumOccupants(const Math::Point< int > &bin_)
Definition: CDGrid.h:256