Click or drag to resize
DigitalRuneDynamicAabbTreeT Class
Represents a dynamic bounding volume tree using axis-aligned bounding boxes (AABBs).
Inheritance Hierarchy
SystemObject
  DigitalRune.Geometry.PartitioningBasePartitionT
    DigitalRune.Geometry.PartitioningDynamicAabbTreeT

Namespace: DigitalRune.Geometry.Partitioning
Assembly: DigitalRune.Geometry (in DigitalRune.Geometry.dll) Version: 1.18.0.0 (1.18.2.14427)
Syntax
public class DynamicAabbTree<T> : BasePartition<T>, 
	ISupportClosestPointQueries<T>, ISupportFrustumCulling<T>

Type Parameters

T
The type of item in the spatial partition.

The DynamicAabbTreeT type exposes the following members.

Constructors
  NameDescription
Public methodDynamicAabbTreeT
Initializes a new instance of the DynamicAabbTreeT class.
Top
Methods
  NameDescription
Public methodAdd (Inherited from BasePartitionT.)
Public methodClear (Inherited from BasePartitionT.)
Public methodClone (Inherited from BasePartitionT.)
Protected methodCloneCore (Overrides BasePartitionTCloneCore(BasePartitionT).)
Public methodContains (Inherited from BasePartitionT.)
Public methodCopyTo (Inherited from BasePartitionT.)
Protected methodCreateInstanceCore (Overrides BasePartitionTCreateInstanceCore.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetClosestPointCandidates(Aabb, Single, FuncT, Single)
Gets all items that are candidates for the smallest closest-point distance to a given axis-aligned bounding box (AABB).
Public methodGetClosestPointCandidates(Vector3F, Pose, ISpatialPartitionT, Vector3F, Pose, FuncT, T, Single)
Gets all items that are candidates for the smallest closest-point distance to items in a given partition.
Public methodGetEnumerator
Returns an enumerator that iterates through the collection.
(Inherited from BasePartitionT.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetOverlaps
Gets overlaps of all items contained in this spatial partition.
(Inherited from BasePartitionT.)
Public methodGetOverlaps(Aabb)
Gets the items that touch the given axis-aligned bounding box (AABB).
(Inherited from BasePartitionT.)
Public methodGetOverlaps(Aabb)
Gets the items that touch the given axis-aligned bounding box (AABB).
(Overrides BasePartitionTGetOverlaps(Aabb).)
Public methodGetOverlaps(ISpatialPartitionT)
Gets overlaps between all items of this spatial partition and the items of another spatial partition.
(Overrides BasePartitionTGetOverlaps(ISpatialPartitionT).)
Public methodGetOverlaps(IListPlane)
Gets the items that touch the bounding volume ("k-DOP") defined by a set of planes.
Public methodGetOverlaps(Ray)
Gets the items that touch the given ray.
(Overrides BasePartitionTGetOverlaps(Ray).)
Public methodGetOverlaps(Vector3F, Pose, ISpatialPartitionT, Vector3F, Pose)
Gets overlaps between all items of this spatial partition and the items of another spatial partition.
(Overrides BasePartitionTGetOverlaps(Vector3F, Pose, ISpatialPartitionT, Vector3F, Pose).)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInvalidate
Invalidates the cached spatial information of all items in the spatial partition.
(Inherited from BasePartitionT.)
Public methodInvalidate(T)
Invalidates the cached spatial information of the specified item.
(Overrides BasePartitionTInvalidate(T).)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRemove (Inherited from BasePartitionT.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUpdate (Inherited from BasePartitionT.)
Top
Properties
  NameDescription
Public propertyAabb
Gets the axis-aligned bounding box (AABB) that contains all items.
(Inherited from BasePartitionT.)
Public propertyBottomUpBuildThreshold
Gets or sets the threshold that determines when a bottom-up tree build method is used.
Public propertyCount (Inherited from BasePartitionT.)
Public propertyEnableMotionPrediction
Gets a value indicating whether motion prediction is enabled.
Public propertyEnableSelfOverlaps
Gets or sets a value indicating whether self-overlaps are computed.
(Inherited from BasePartitionT.)
Public propertyFilter
Gets or sets the filter that is used to filter overlaps of two items.
(Inherited from BasePartitionT.)
Public propertyGetAabbForItem
Gets or sets the method that computes the Aabb of an item.
(Inherited from BasePartitionT.)
Public propertyMotionPrediction
Gets or sets the number of frames a linear motion is predicted into the future. (Only applied if motion prediction is enabled.)
Public propertyOptimizationPerFrame
Gets or set the amount of incremental optimization per frame (time step).
Public propertyRelativeMargin
Gets or sets a relative margin that is added to the AABB of moving objects. (Only applied if motion prediction is enabled.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodIEnumerableTGetEnumerator
Returns an enumerator that iterates through the collection.
(Inherited from BasePartitionT.)
Explicit interface implementationPrivate methodIEnumerableGetEnumerator
Returns an enumerator that iterates through a collection.
(Inherited from BasePartitionT.)
Explicit interface implementationPrivate propertyICollectionTIsReadOnly (Inherited from BasePartitionT.)
Explicit interface implementationPrivate methodISpatialPartitionTClone
Creates a new spatial partition that is a clone (deep copy) of the current instance.
(Inherited from BasePartitionT.)
Top
Remarks

The DynamicAabbTreeT was inspired by the dynamic bounding volume tree (btDbvt) as implemented in the Bullet Continuous Collision Detection and Physics Library. (Original btDbvt implementation by Nathanael Presson.)

The DynamicAabbTreeT was designed to manage deformable objects efficiently. It should be uses for CompositeShapes or TriangleMeshShapes when the the contained shapes or triangles are updated at runtime.

It can also be used as a collision detection broad-phase (see BroadPhase).

Incremental Optimization: When items in the AABB tree are added, removed or moved the AABB tree might become unbalanced and less optimal for collision detection. Therefore, the DynamicAabbTreeT tries to optimize its tree structure over time. In each frame (time step) it performs a number of optimization passes. The amount of optimization per frame can be controlled by setting OptimizationPerFrame.

Motion Prediction: The dynamic AABB tree is further optimized for models/space where items are constantly moving. The DynamicAabbTreeT automatically detects when items are moving. It adds a small margin (see RelativeMargin) to the AABB of these items to account for small random movements ("jittering") and it extends the AABB in the direction the items are moving (see MotionPrediction). This reduces the number of required tree updates per frame. However, the downside is that the AABB tree is more conservative (safe, but less accurate). It might return more overlaps ("false positives") than other types of spatial partitions.

Motion predication can be enabled by setting EnableMotionPrediction. The feature is disabled by default.

AdaptiveAabbTreeT vs. DynamicAabbTreeT: The AdaptiveAabbTreeT and the DynamicAabbTreeT are similar data structures. As a general rule, the AdaptiveAabbTreeT should be used if

Whereas the DynamicAabbTreeT should be used if
  • Individual items are invalidated frequently by calling Invalidate(T).
  • Items are added or removed frequently. (Inserting or removing individual items into/from a DynamicAabbTreeT is fast.)

The AdaptiveAabbTreeT should not be used as the collision detection broad-phase (see BroadPhase). Whereas, a DynamicAabbTreeT can be used as the collision detection broad-phase.

However, please note these are just general rules. You should always try different ISpatialPartitionT types and measure which one yields the best performance in your application.

Special handling of self-overlaps in GetOverlaps(ISpatialPartitionT): If GetOverlaps(ISpatialPartitionT) is used to test an AABB tree against itself then overlaps of an item with itself are not returned. That means, each item A overlaps with itself, but (A, A) is not returned. And if two different items overlap, only one overlap is returned, for example: If item A and item B overlap (A, B) or (B, A) is returned, but not both.

See Also