This is the documentation for Enlighten.

class Geo GeoSpatialHash

class Geo::GeoSpatialHash

The 3D hash table.

Classes

Name Description
Geo::GeoSpatialHash::GridCellBlock

The grid index box.

Variables

Name Description
Geo::s32 m_Capacity

The capacity of the grid.

Geo::s32 * m_CellOffsets

This is the number of items in each cell.

Geo::GeoArray< GeoSpatialHashEntry > m_CellRefs

This is of size n, where n is the number of items.

Geo::v128 m_CellSize

The size of each cell. Divide by this to convert to voxel space.

Geo::s32 m_GridCells[3]

The grid discrete size.

Geo::v128 m_GridExtents

The grid extents.

Geo::v128 m_GridOffset

The grid offset. Add something this to a vector to get it into grid space.

Geo::s32 m_NumCells

This the number of cells.

bool m_Sorted

Has this been prepared?

Functions

Name Description
~GeoSpatialHash()

Destructor.

AddInBounds(const Geo::GeoBoundingBox &, Geo::s32)

Add an object to an extent.

GeoSpatialHash(const Geo::GeoBoundingBox &, Geo::u32, Geo::u32, Geo::u32, Geo::u32)

Constructor. CellCount is how many cells along each axis there should be.

GetBaseKey(Geo::u32, Geo::u32, Geo::u32)

Get the base key.

GetGridCellBlock(const Geo::GeoBoundingBox &, GridCellBlock &)

Convert a bbox to GridIndexBox.

GetInExtent(const Geo::GeoBoundingBox &, Geo::GeoArray< Geo::s32 > &)

Get the list of objects inside a given bounding box.

GetObjectsInCell(Geo::u32, Geo::GeoArray< Geo::s32 > &)

Get all the objects inside a given cell.

PrepareMap()

Once you've added all the vertices, call this.

QSortComparison(const void *, const void *)

Function used by qsort to compare map entries.

TransformPoint(const Geo::v128 &)

Transform a point into our voxel space.


Geo::GeoSpatialHash::~GeoSpatialHash


public: ~GeoSpatialHash()


Destructor.


bool Geo::GeoSpatialHash::AddInBounds


public: bool AddInBounds
(
    const Geo::GeoBoundingBox & bbox,
    Geo::s32 vertex
)


Add an object to an extent.


Geo::GeoSpatialHash::GeoSpatialHash


public: GeoSpatialHash
(
    const Geo::GeoBoundingBox & extents,
    Geo::u32 numEntries,
    Geo::u32 xCells,
    Geo::u32 yCells,
    Geo::u32 zCells
)


Constructor. CellCount is how many cells along each axis there should be.


Geo::u32 Geo::GeoSpatialHash::GetBaseKey


protected: Geo::u32 GetBaseKey
(
    Geo::u32 x,
    Geo::u32 y,
    Geo::u32 z
) const


Get the base key.


void Geo::GeoSpatialHash::GetGridCellBlock


protected: void GetGridCellBlock
(
    const Geo::GeoBoundingBox & bbox,
    GridCellBlock & grid
) const


Convert a bbox to GridIndexBox.


bool Geo::GeoSpatialHash::GetInExtent


public: bool GetInExtent
(
    const Geo::GeoBoundingBox & bbox,
    Geo::GeoArray< Geo::s32 > & vertexIDList
) const


Get the list of objects inside a given bounding box.


void Geo::GeoSpatialHash::GetObjectsInCell


protected: void GetObjectsInCell
(
    Geo::u32 key,
    Geo::GeoArray< Geo::s32 > & list
) const


Get all the objects inside a given cell.


void Geo::GeoSpatialHash::PrepareMap


public: void PrepareMap()


Once you've added all the vertices, call this.


static Geo::s32 Geo::GeoSpatialHash::QSortComparison


protected: Geo::s32 QSortComparison
(
    const void * arg1,
    const void * arg2
)


Function used by qsort to compare map entries.


Geo::v128 Geo::GeoSpatialHash::TransformPoint


protected: Geo::v128 TransformPoint
(
    const Geo::v128 & point
) const


Transform a point into our voxel space.