Class TOctree

Unit

Declaration

type TOctree = class(TObject)

Description

An octree.

You can read about octrees on the Wikipedia.

See also
TWorld3D.Octree
Access to octree.

Hierarchy

  • TObject
  • TOctree

Overview

Methods

Public CONSTRUCTOR Create;
Public DESTRUCTOR Destroy; OVERRIDE;
Public procedure Initialize (const aSize: GLfloat; const aDepth: Integer);
Public FUNCTION InsertObject (CONST aObject: TObject3D): TOctreeNode;
Public PROCEDURE RemoveObject (CONST aObject: TObject3D); INLINE;
Public PROCEDURE Clear;
Public PROCEDURE Show; INLINE;

Properties

Public property Root: TOctreeNode READ fRoot;
Public property Depth: INTEGER READ fDepth;

Description

Methods

Public CONSTRUCTOR Create;

Create an empty octree with default size and depth.

See also
Initialize
Init the octree.
DefaultWorldSize
Default world size.
DefaultOctreeDepth
Default octree depth.
Public DESTRUCTOR Destroy; OVERRIDE;

Release the resources.

Public procedure Initialize (const aSize: GLfloat; const aDepth: Integer);

Init the octree.

This method will clear the octree and rebuild it.

The root node will be centered at <0, 0, 0>, so it will span <-aSize, -aSize, -aSize> to <aSize, aSize, aSize>. It is not a physical limit and objects would be outside the boudings; in such case the object will be in the root node.

Note that octree will grow exponentially. For example, a level 4 octree will use 585 nodes while a level 5 one will use 5681. So don't create octrees too deep.

Parameters
aSize
Root node size.
aDepth
Otree depth.
See also
TOctree.Clear
Removes all objects from the octree.
Public FUNCTION InsertObject (CONST aObject: TObject3D): TOctreeNode;

Inserts the object in the octree and returns the node.

Public PROCEDURE RemoveObject (CONST aObject: TObject3D); INLINE;

Removes the object from the octree.

Public PROCEDURE Clear;

Removes all objects from the octree.

Public PROCEDURE Show; INLINE;

Draws the octree.

Properties

Public property Root: TOctreeNode READ fRoot;

Reference to the root node.

Public property Depth: INTEGER READ fDepth;

Tree depth.


Generated by PasDoc 0.15.0. Generated on 2025-07-31 11:41:01.