Class TTriangleOctree

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TTriangleOctree = class(TBaseTrianglesOctree)

Description

Octree based on triangles. Allows for fast collision-detection with a set of triangles. Each triangle is a TTriangle structure, that keeps triangle geometry in 3D space, and links to parent VRML Shapes and such.

Hierarchy

Overview

Fields

Public Triangles: TTriangleList;
Public DirectCollisionTestsCounter: TCollisionCount;

Methods

Public constructor Create(const ARootBox: TBox3D); overload;
Public constructor Create(const ALimits: TOctreeLimits; const ARootBox: TBox3D); overload;
Public destructor Destroy; override;
Public function TreeRoot: TTriangleOctreeNode;
Public procedure AddItemTriangle(Shape: TObject; const Position: TTriangle3Single; const Normal: TTriangle3Single; const TexCoord: TTriangle4Single; const Face: TFaceIndex);
Public procedure EnumerateTriangles(EnumerateTriangleFunc: TEnumerateTriangleFunc); override;
Public function TrianglesCount: Cardinal; override;

Description

Fields

Public Triangles: TTriangleList;

All our triangles.

By keeping a list of triangles here, and only keeping indexes to this table in leafs (in ItemsIndices) we conserve a lot of memory. This also allows to use mailboxes and fast TriangleToIgnore (because every triangle has a unique index, and a pointer too, shared even if this triangle is placed in multiple leaves).

Public DirectCollisionTestsCounter: TCollisionCount;

Direct collisions counter, to test octree efficiency.

It is incremented each time XxxCollision make a direct collision test, that is when some single triangle is tested for collision with a sphere, line segment and such. The very idea of octree is to minimize this number.

0 by default.

Methods

Public constructor Create(const ARootBox: TBox3D); overload;
 
Public constructor Create(const ALimits: TOctreeLimits; const ARootBox: TBox3D); overload;
 
Public destructor Destroy; override;
 
Public function TreeRoot: TTriangleOctreeNode;
 
Public procedure AddItemTriangle(Shape: TObject; const Position: TTriangle3Single; const Normal: TTriangle3Single; const TexCoord: TTriangle4Single; const Face: TFaceIndex);

Add a single triangle. Automatically checks whether IsValidTriangle. Before adding a lot of triangles, it's suggested to increase Triangles.AllowedCapacityCount.

Public procedure EnumerateTriangles(EnumerateTriangleFunc: TEnumerateTriangleFunc); override;
 
Public function TrianglesCount: Cardinal; override;
 

Generated by PasDoc 0.12.1 on 2013-02-04 20:26:52