![]() |
VR-Forces 5.0.2 Developer's Guide
|
Classes | |
| struct | Entry |
| struct | Node |
| struct | Page |
Public Types | |
| typedef unsigned int | NodeIndex |
| typedef unsigned int | PageIndex |
Public Member Functions | |
| SpatialIndex () | |
| ~SpatialIndex () | |
| Bool | insert (const DATA_ID globalId, const Vector3d &pos) |
| Bool | insert (const DATA_ID globalId, const Vector3d &pos, const UInt64 key) |
| Bool | remove (const DATA_ID globalId) |
| Bool | update (const DATA_ID globalId, const Vector3d &pos) |
| std::vector< DATA_ID > | nearestNeighbors (const Vector3d &loc, double distanceInMeter) const |
| std::vector< DATA_ID > | objectsWithin (const Vector3d &min, const Vector3d &max) const |
| std::vector< DATA_ID > | objectsWithin (const Vector2d &minLatLonDeg, const Vector2d &maxLatLonDeg) const |
| std::vector< DATA_ID > | objectsNearChord (const Vector3d &pointA, const Vector3d &pointB, const double delta) const |
| std::vector< DATA_ID > | spatialTreeWalk (UInt32 &totalDataCnt) const |
| bool | isDistanceToLineWithin (const Vector3d &pointC, double distance, const Vector3d &lineA, const Vector3d &lineB) const |
| bool | isWholeGlobeRegion (const Vector3d &pos1, const Vector3d &pos2) const |
| void | reset () |
| void | endFrame () |
Static Public Member Functions | |
| static Vector2d | geocToSpherical (const Vector3d &pos) |
| static UInt64 | my_pdep_u64 (UInt64 val, UInt64 mask) |
| static UInt64 | geocentricToSpatialKey (const Vector3d &pos) |
Protected Member Functions | |
| void | growNodes (int count) |
| void | growPages (int count) |
| int | findNodeToAdd (const UInt64 key) |
| Bool | needSplit (const NodeIndex nodeIdx) const |
| Bool | canSplit (const NodeIndex nodeIdx) const |
| Bool | splitNode (NodeIndex n) |
| int | nextNode () |
| int | nextPage () |
| NodeIndex | findNodeContaining (NodeIndex, const UInt64 key) const |
| NodeIndex | findCommonRootNode (NodeIndex idx, const UInt64 key1, const UInt64 key2) const |
| bool | generateMinMaxKeys (const Vector3d &pos1, const Vector3d &pos2, UInt64 &minKey, UInt64 &maxKey, Vector3d &minPos, Vector3d &maxPos) const |
| bool | generateMinMaxKeys (const Vector3d &pos1, const Vector3d &pos2, UInt64 &minKey, UInt64 &maxKey) const |
| UInt32 | objectsWithinNode (const NodeIndex idx, const UInt64 minKey, const UInt64 maxKey, const Vector3d &absMin, const Vector3d &absMax, std::vector< DATA_ID > &result) const |
| UInt32 | objectsWithinNode (const NodeIndex idx, const UInt64 minKey, const UInt64 maxKey, const Vector3d &pos1, const Vector3d &pos2, const double distance, std::vector< DATA_ID > &result) const |
| UInt32 | objectsWithinNode (const NodeIndex idx, const Vector2d &latLong1, const Vector2d &latLong2, std::vector< DATA_ID > &result) const |
| void | eraseFromPage (Page &p, DATA_ID globalId) |
| void | addToPage (Page &p, DATA_ID globalId, UInt64 key, const Vector3d &loc) |
| bool | contains (UInt64 key, NodeIndex n) |
| bool | isPositionWithin (const Vector3d &min, const Vector3d &max, const Vector3d &pos) const |
| bool | isPositionWithin (const Vector2d &latLong1, const Vector2d &latLong2, const Vector3d &pos) const |
Protected Attributes | |
| UInt32 | myNodeCount |
| UInt32 | myPageCount |
| std::queue< int > | myFreePageQueue |
| std::vector< Node > | myNodes |
| std::vector< Page > | myPages |
| std::mutex | myPageMutex |
| std::mutex | myNodeMutex |
| std::unordered_map< DATA_ID, int > | myReverseLookup |
Static Protected Attributes | |
| static const UInt64 | MASK_AZIMUTH_ODD_BITS = (0x5555555555555555ULL) |
| static const UInt64 | MASK_ELEVATION_EVEN_BITS = (0xAAAAAAAAAAAAAAAAULL) |
| static const UInt64 | MASK_AZIMUTH_OBITS_REVERSE = ~(0x5555555555555555ULL) |
| static const UInt64 | MASK_ELEVATION_EBITS_REVERSE = ~(0xAAAAAAAAAAAAAAAAULL) |
| static const int | SpatialMaxNodeDepth = 31 |
| static const int | thePageSize = 100 |
Static Private Attributes | |
| static const int | BITS_PER_COMPONENT = 30 |
| static const int | BITS_PER_COMPONENT_AND_REGION = 31 |
| typedef unsigned int MAK::SpatialIndex< DATA_ID >::NodeIndex |
| typedef unsigned int MAK::SpatialIndex< DATA_ID >::PageIndex |
| MAK::SpatialIndex< DATA_ID >::SpatialIndex | ( | ) |
Public APIs.
| MAK::SpatialIndex< DATA_ID >::~SpatialIndex | ( | ) |
| Bool MAK::SpatialIndex< DATA_ID >::insert | ( | const DATA_ID | globalId, |
| const Vector3d & | pos | ||
| ) |
Generate spatial key and insert entity's global ID and location into spatial tree.
| Bool MAK::SpatialIndex< DATA_ID >::insert | ( | const DATA_ID | globalId, |
| const Vector3d & | pos, | ||
| const UInt64 | key | ||
| ) |
Insert the spatial key and entity's global ID and location into spatial tree.
| Bool MAK::SpatialIndex< DATA_ID >::remove | ( | const DATA_ID | globalId | ) |
Find the entity data identified by globalId and remove the object from the spatial tree.
| Bool MAK::SpatialIndex< DATA_ID >::update | ( | const DATA_ID | globalId, |
| const Vector3d & | pos | ||
| ) |
Update entity's location.
| std::vector<DATA_ID> MAK::SpatialIndex< DATA_ID >::nearestNeighbors | ( | const Vector3d & | loc, |
| double | distanceInMeter | ||
| ) | const |
Find nearest neighbors from the input location, neighbors x/y/z locations are <= distanceInMeter. It returns an array of global IDs.
| std::vector<DATA_ID> MAK::SpatialIndex< DATA_ID >::objectsWithin | ( | const Vector3d & | min, |
| const Vector3d & | max | ||
| ) | const |
Find objects within the area of min and max locations, including the min & max locations.
| std::vector<DATA_ID> MAK::SpatialIndex< DATA_ID >::objectsWithin | ( | const Vector2d & | minLatLonDeg, |
| const Vector2d & | maxLatLonDeg | ||
| ) | const |
Find objects within the area of latitude and longitude specified in degree.
| std::vector<DATA_ID> MAK::SpatialIndex< DATA_ID >::objectsNearChord | ( | const Vector3d & | pointA, |
| const Vector3d & | pointB, | ||
| const double | delta | ||
| ) | const |
Find objects within the delta distance from the chord defined by npoint A & B.
| std::vector<DATA_ID> MAK::SpatialIndex< DATA_ID >::spatialTreeWalk | ( | UInt32 & | totalDataCnt | ) | const |
| bool MAK::SpatialIndex< DATA_ID >::isDistanceToLineWithin | ( | const Vector3d & | pointC, |
| double | distance, | ||
| const Vector3d & | lineA, | ||
| const Vector3d & | lineB | ||
| ) | const |
Find the shortest distance from the point C to the line.
| bool MAK::SpatialIndex< DATA_ID >::isWholeGlobeRegion | ( | const Vector3d & | pos1, |
| const Vector3d & | pos2 | ||
| ) | const |
| void MAK::SpatialIndex< DATA_ID >::reset | ( | ) |
Reset the entity entries, but maintains the node tree since that is likely useful the next frame.
| void MAK::SpatialIndex< DATA_ID >::endFrame | ( | ) |
|
inlinestatic |
spatial key generation specific static member functions
Referenced by MAK::SpatialIndex< DATA_ID >::geocentricToSpatialKey().
|
inlinestatic |
Referenced by MAK::SpatialIndex< DATA_ID >::geocentricToSpatialKey().
|
inlinestatic |
|
protected |
|
protected |
|
protected |
NodeIndex findNodeToAdd(const UInt64 key);.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprivate |
Referenced by MAK::SpatialIndex< DATA_ID >::geocentricToSpatialKey().
|
staticprivate |
|
staticprotected |
60 bits masks used to encode or decode spatial keys (AZIMUTH, ELEVATION), Top 2 most significant bits are not used, the 61th-62th bits are spatial regionID
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
Referenced by MAK::SpatialIndex< DATA_ID >::Page::Page().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |