SpatialIndex class

From Solid Graphics Wiki

Jump to: navigation, search
SpatialIndex class
Namespace: SKL3D
Base type: (None)
Include: Skl3DIndex.h
Lib (Release): SKL.lib
Lib (Debug): SKL_D.lib


The SpatialIndex class provides spatial sorting of 3D objects in 3D space using octtree. It can be used for example for purposes of efficient collision detection between 3D objects, of for spatial queries, like "find me all 3D objects in my camera view".


Constructors

The class provides tow constructors - one without any parameters and second with the same parameters as the SpatialIndex::Create method.

The no-parameters-constructor provides just basic initialization. If you use it then you must later on call SpatialIndex::Create method to specify additional spatial index parameters.

The second constructor internally calls the SpatialIndex::Create method after the basic object initialization.

Fields

The class has no public fields.

Methods

Method name Description
Create Initializes spatial index for specified BoundingBox spatiam index extent. It is important to specify the extent to enclose whole scene, as specifying smaller extent would cause objects falling outside the extent to end up in top octreee node, therefore diminishing the octree advantage for spatial sorting.
Reindex Changes BoundingBox extent of the spatial index and reindex all objects already in the spatial for using the new extent.
Clear Removes all objects from the spatial index and all internal octree nodes.
AddObject Adds object into the spatial index by specifying the object id and it's bounding box.
DeleteObject Deletes object from the index by specifying the object id and it's bounding box.
Extent Returns currently specified spatial index's bounding box extent.
FindFirst Depending on parameter it finds first spatial index's object in specified bounding box or first object intersecting specified line segment.
FindNext Finds next object in the bounding box or intersecting the line segment specified by the previous FindFirst method call.
FindFirstIntersection Finds first two intersecting objects. First objects will be from the spatial index instance, the second object from another specified spatial index.
FindNextIntersection Finds next two intersecting objects, one from the spatial index and the another from index previously specified in the FindFirstIntersection call.
ObjectCount Ruturns number of object currently indexed by the spatial index object.

Operators

The class has no public operators.

See Also

   


SolidKit Library Documentation

Personal tools