Castle Game Engine: CastleTriangleOctree: Class TTriangleOctree

# Class TTriangleOctree
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleTriangleOctree ## 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 TObject TOctree TBaseTrianglesOctree TTriangleOctree ## Overview ### Fields
| `Triangles: TTriangleList;`
### Methods
| `function StatisticsBonus( const LeavesCount, ItemsCount, NonLeafNodesCount: Int64): string; override;`
| `constructor Create(const ARootBox: TBox3D); overload;`
| `constructor Create(const ALimits: TOctreeLimits; const ARootBox: TBox3D); overload;`
| `destructor Destroy; override;`
| `function TreeRoot: TTriangleOctreeNode;`
| `procedure AddItemTriangle(Shape: TObject; const Position: TTriangle3Single; const Normal: TTriangle3Single; const TexCoord: TTriangle4Single; const Face: TFaceIndex);`
| `procedure EnumerateTriangles(EnumerateTriangleFunc: TEnumerateTriangleFunc); override;`
| `function TrianglesCount: Cardinal; override;`
## Description ### Fields
| `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).
### Methods
| `function StatisticsBonus( const LeavesCount, ItemsCount, NonLeafNodesCount: Int64): string; override;`
| `constructor Create(const ARootBox: TBox3D); overload;`
| `constructor Create(const ALimits: TOctreeLimits; const ARootBox: TBox3D); overload;`
| `destructor Destroy; override;`
| `function TreeRoot: TTriangleOctreeNode;`
| `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.
| `procedure EnumerateTriangles(EnumerateTriangleFunc: TEnumerateTriangleFunc); override;`
| `function TrianglesCount: Cardinal; override;`
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:12