Class TOctreeNode

Unit

Declaration

type TOctreeNode = class(TObject)

Description

An octree node.

This class is for internal use and you shouldn't need to deal with it.

See also
TOctree
An octree.

Hierarchy

  • TObject
  • TOctreeNode

Overview

Methods

Public CONSTRUCTOR Create ( const aLeft, aRight, aBottom, aTop, aBack, aFront: GLfloat; aLevel: INTEGER; CONST aParent: TOctreeNode);
Public DESTRUCTOR Destroy; OVERRIDE;
Public FUNCTION Inside (CONST point: TVector3D): BOOLEAN; OVERLOAD;
Public FUNCTION Inside (CONST pos: TVector3D; CONST r: GLfloat): BOOLEAN; OVERLOAD;
Public FUNCTION Inside (CONST aObject: TObject3D): BOOLEAN; OVERLOAD;
Public function GetChild (const aPosition: TVector3D; const aRadius: GLfloat) : TOctreeNode;
Public PROCEDURE Clear;
Public FUNCTION IsNear (CONST Point: TVector3D; CONST aDistance2: GLfloat): BOOLEAN;
Public PROCEDURE Show;

Properties

Public property Children[Id:INTEGER]: TOctreeNode READ GetChildren;
Public property Parent: TOctreeNode READ fParent;
Public property HasObjects: BOOLEAN READ fHasObjects;
Public property FirstObject: TObject3D READ fFirstObject;
Public property Limits: TBox read fLimits;

Description

Methods

Public CONSTRUCTOR Create ( const aLeft, aRight, aBottom, aTop, aBack, aFront: GLfloat; aLevel: INTEGER; CONST aParent: TOctreeNode);

Creates the node. Parameters are the position of each plane of the cube.

Parameters
aLevel
If it is not 0, it creates childs.
Public DESTRUCTOR Destroy; OVERRIDE;

Releases resources.

Public FUNCTION Inside (CONST point: TVector3D): BOOLEAN; OVERLOAD;

Retruns True if point is inside the node.

Public FUNCTION Inside (CONST pos: TVector3D; CONST r: GLfloat): BOOLEAN; OVERLOAD;

Returns True if an sphere of radius r in position pos is fully inside the node.

Public FUNCTION Inside (CONST aObject: TObject3D): BOOLEAN; OVERLOAD;

Returns True if object is fully inside the node. It uses bounding box if available or bounding sphere otherwise.

See also
TOctreeNode.GetChild
Find the smallest node that contains the given sphere.
Public function GetChild (const aPosition: TVector3D; const aRadius: GLfloat) : TOctreeNode;

Find the smallest node that contains the given sphere.

Parameters
aPosition
The sphere center position.
aRadius
The sphere radius.
Returns

The reference to the smallest node that fully contains the sphere or Nil if no node contains it.

See also
TOctreeNode.Inside
Returns True if object is fully inside the node.
Public PROCEDURE Clear;

Clear all objects from node and childs.

Public FUNCTION IsNear (CONST Point: TVector3D; CONST aDistance2: GLfloat): BOOLEAN;

Returns True if node distance to the point is less than the given distance.

Parameters
aDistance2
The square of the distance.
Public PROCEDURE Show;

Draws the node.

Properties

Public property Children[Id:INTEGER]: TOctreeNode READ GetChildren;

Child nodes. The order of nodes is:

<-1, -1, -1> < 1, -1, -1>
<-1,  1, -1> < 1,  1, -1>

<-1, -1,  1> < 1, -1,  1>
<-1,  1,  1> < 1,  1,  1>

Public property Parent: TOctreeNode READ fParent;

Parent node.

Public property HasObjects: BOOLEAN READ fHasObjects;

Tells if node is empty.

A node isn't empty if it has any object or one of its childs isn't empty.

Public property FirstObject: TObject3D READ fFirstObject;

Reference to the first object contained in the node.

See also
TObject3D.NextObject
Next object in the octree node.
Public property Limits: TBox read fLimits;

Limits of node.


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