Class OctreeF<P>
Tree data structure in which each internal node has up to eight children. Octrees are most often used to partition a three-dimensional space by recursively subdividing it into eight octants.
Inheritance
Inherited Members
Namespace: Fusee.Structures
Assembly: Fusee.Structures.dll
Syntax
public abstract class OctreeF<P>
Type Parameters
Name | Description |
---|---|
P | The type of an octants payload. |
Fields
MaxLevel
The maximum level this octree has - corresponds to the maximum number of subdivisions of an Octant. Can be used as subdivision termination condition or be set in the method SubdivTerminationCondition(OctantF<P>).
Declaration
public int MaxLevel
Field Value
Type | Description |
---|---|
System.Int32 |
Root
The root Octant of this Octree.
Declaration
public OctantF<P> Root
Field Value
Type | Description |
---|---|
OctantF<P> |
Methods
GetChildPosition(OctantF<P>, P)
Needed for subdivision - method that provides functionality to determine and return the index (position) of the child a payload item will fall into.
Declaration
protected abstract int GetChildPosition(OctantF<P> octant, P payloadItem)
Parameters
Type | Name | Description |
---|---|---|
OctantF<P> | octant | The octant to subdivide. |
P | payloadItem | The payload item for which the child index is determined. |
Returns
Type | Description |
---|---|
System.Int32 |
HandlePayload(OctantF<P>, OctantF<P>, P)
Needed for subdivision - method that determines what happens to a payload item after the generation of an octants children.
Declaration
protected abstract void HandlePayload(OctantF<P> parent, OctantF<P> child, P payloadItem)
Parameters
Type | Name | Description |
---|---|---|
OctantF<P> | parent | The parent octant. |
OctantF<P> | child | The child octant a payload item falls into. |
P | payloadItem | The payload item. |
Subdivide(OctantF<P>)
Subdivision creates the children of an Octant. Here the payload of an Octant will be iterated and for each item it is determined in which child it will fall. If there isn't a child already it will be created.
Declaration
public virtual void Subdivide(OctantF<P> octant)
Parameters
Type | Name | Description |
---|---|---|
OctantF<P> | octant | The Octant to subdivide. |
SubdivTerminationCondition(OctantF<P>)
Needed for subdivision - Method that returns a condition that terminates the subdivision.
Declaration
protected abstract bool SubdivTerminationCondition(OctantF<P> octant)
Parameters
Type | Name | Description |
---|---|---|
OctantF<P> | octant | The octant to subdivide. |
Returns
Type | Description |
---|---|
System.Boolean |
Traverse(OctantF<P>, Action<OctantF<P>>)
Start traversing (breadth first) from a given node.
Declaration
public void Traverse(OctantF<P> node, Action<OctantF<P>> callback)
Parameters
Type | Name | Description |
---|---|---|
OctantF<P> | node | |
System.Action<OctantF<P>> | callback |
Traverse(Action<OctantF<P>>)
Start traversing (breadth first) from the root node.
Declaration
public void Traverse(Action<OctantF<P>> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action<OctantF<P>> | callback |