SpatialTree

Description

abstract class Tinman.Terrain.Util.SpatialTree
<TEntity val>
<TBounds val>
<TCoords val>
<TEntityTrait ref : ISpatialEntityTrait<TEntity, TBounds>>
<TBoundsTrait val : ISpatialBoundsTrait<TCoords, TBounds>>
<TDistanceTrait val : ISpatialDistanceTrait<TEntity, TCoords>>

Derived from

SpatialTree_Entity<TBounds, TCoords, TEntity> abstract

Extended by

SpatialOctree abstract
SpatialQuadtree abstract

A generic tree data structure for storing spatial entities.

Public / Methods

Add


public method Add → (1)

entity in : TEntity

The entity to add.

Adds the given spatial entity to the tree.

Bounds​Grow


public method BoundsGrow → (1)

bounds in : TBounds

To bounds to cover.

Grows the tree until it contains the given bounds.

Clear


public method Clear → ()

Clears the tree.

Deserialize


public method Deserialize → (2)

data in : ISerializer

[not-null]
The serializer object.

entity in : ITypeSerializer<TEntity>

[not-null]
The type serializer for tree nodes.

Deserializes the tree nodes.

IOException

If an I/O error has occurred.

Entities

2 overloads


public method Entities1 → (1)

node in : SpatialTreeNode<TBounds>

The spatial tree node.

returns → TEntity [ ]

The spatial entities in node in.

Returns the spatial entities in the given spatial tree node.


public method Entities2 → (2)

node in : SpatialTreeNode<TBounds>

The spatial tree node.

entities in : ICollector<TEntity>

[not-null]
The collector for spatial entities.

Collects the spatial entities in the given spatial tree node.

Entity​Grow


public method EntityGrow → (1)

capacity in : int64

The new capacity, in slots.

Grows the spatial entity slot storage.

Serialize


public method Serialize → (2)

data in : ISerializer

[not-null]
The serializer object.

entity in : ITypeSerializer<TEntity>

[not-null]
The type serializer for tree nodes.

Serializes the tree nodes.

IOException

If an I/O error has occurred.

Protected / Constructors

Spatial​Tree


protected constructor SpatialTree → (5)

childCount in : int32

[pow2]
The maximum number of children per tree node.

bounds in : TBounds

The initial spatial bounds.

boundsSerializer in : ITypeSerializer<TBounds>

[not-null]
The serializer for tree bounds.

entityTrait in : TEntityTrait

The entity trait.

distanceTrait in : TDistanceTrait

The distance trait.

Creates a new instance of SpatialTree.

Protected / Methods

Node​Pop


protected method NodePop → ()

returns → int32

The tree node index.

Allocates a new tree node slot.

Protected / Attributes

bounds​Trait


protected readonly attribute boundsTrait → (TBoundsTrait)

The spatial tree node bounds trait.

distance​Trait


protected readonly attribute distanceTrait → (TDistanceTrait)

The distance trait.