Unit CastleOctree

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

Base octree classes (TOctreeNode and TOctree) and utilities. Used by actual octrees in units like CastleTriangleOctree and CastleShapeOctree.

Typical way to derive actual (non-abstract) octrees goes like this;

type
  TMyOctree = class;

  TMyOctreeNode = class(TOctreeNode)
  protected
    procedure PutItemIntoSubNodes(ItemIndex: integer); override;
  public
    function ParentTree: TMyOctree;
 end;

  TMyOctree = class(TOctree)
  public
    constructor Create(AMaxDepth, ALeafCapacity: Integer;
      const ARootBox: TBox3D);
    function TreeRoot: TMyOctreeNode;
  end;

{ implementation }

procedure TMyOctreeNode.PutItemIntoSubNodes(ItemIndex: integer);
begin
  { See comments at @link(TOctreeNode.PutItemIntoSubNodes)
    to know how you should implement this. }
end;

function TMyOctreeNode.ParentTree: TMyOctree;
begin
  Result := TMyOctree(InternalParentTree);
end;

constructor TMyOctree.Create(AMaxDepth, ALeafCapacity: Integer;
  const ARootBox: TBox3D);
begin
  inherited Create(AMaxDepth, ALeafCapacity, ARootBox, TMyOctreeNode);
end;

function TMyOctree.TreeRoot: TMyOctreeNode;
begin
  Result := TMyOctreeNode(InternalTreeRoot);
end;

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TOctreeNode Octree node.
record TOctreeLimits Helper structure to keep octree limits.
Class TOctree Base abstract octree class.

Functions and Procedures

function OctreeSubnodeIndexToNiceStr(const SI: TOctreeSubnodeIndex): string;
function OctreeSubnodeIndexesEqual(const SI1, SI2: TOctreeSubnodeIndex): boolean;

Types

TOctreeNodeClass = class of TOctreeNode;
TOctreeSubnodeIndex = array[0..2]of boolean;
TEnumerateOctreeItemsFunc = procedure(ItemIndex: Integer; CollidesForSure: boolean) of object;
POctreeLimits = ˆTOctreeLimits;

Description

Functions and Procedures

function OctreeSubnodeIndexToNiceStr(const SI: TOctreeSubnodeIndex): string;
 
function OctreeSubnodeIndexesEqual(const SI1, SI2: TOctreeSubnodeIndex): boolean;
 

Types

TOctreeNodeClass = class of TOctreeNode;
 
TOctreeSubnodeIndex = array[0..2]of boolean;
 
TEnumerateOctreeItemsFunc = procedure(ItemIndex: Integer; CollidesForSure: boolean) of object;
 
POctreeLimits = ˆTOctreeLimits;
 

Generated by PasDoc 0.13.0 on 2013-08-17 21:27:13