SolidKit3D.SpatialIndex class

From Solid Graphics Wiki

Jump to: navigation, search
SolidKit3D.SpatialIndex class
Namespace: SolidKit3D
Base type: (None)
Assembly: SolidKit.dll
Platform: .NET

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".


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.


The class has no public fields.


Method name Description
Create Initializes spatial index for specified bounding box spatial 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 bounding box 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 SpatialIndex.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.


The class has no public operators.

See Also


SolidKit Library Documentation

Personal tools