Kigs Framework  Doc version 0.8
Open source multi purpose Rapid Application Development framework
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
AABBTreeNode Class Reference

#include <AABBTree.h>

Inheritance diagram for AABBTreeNode:

Public Member Functions

 AABBTreeNode ()
virtual ~AABBTreeNode ()
 destructor More...

Public Attributes

AABBTreeNodemSon1 = nullptr
 sons. AABBTree is a binary tree
BBox mBBox
 BBox for this node.

Protected Member Functions

template<typename t >
void Build2 (AABBTree *root, BuildTriangle< t > *TrArray, BuildTriangle< t > *TmpTrArray, unsigned int TrCount, Point3D *VertexArray, const int leafSize, int lastSortMode, BBox currentbbox)

Protected Attributes

int mTriangleCount = 0
 triangle count in this BBox


class AABBTreeNode
class Collision

Detailed Description

Node structure in a Axis Aligned Bounding box tree, used to optimise intersection calculation.

Constructor & Destructor Documentation

◆ ~AABBTreeNode()

AABBTreeNode::~AABBTreeNode ( )


delete son nodes

Member Function Documentation

◆ Build2()

template<typename t >
void AABBTreeNode::Build2 ( AABBTree root,
AABBTreeNode::BuildTriangle< t > *  TrArray,
BuildTriangle< t > *  TmpTrArray,
unsigned int  TrCount,
Point3D *  VertexArray,
const int  leafSize,
int  lastSortMode,
BBox  currentbbox 

first compute triangle array BoundingBox

Compute bounding box diagonal

if Triangle count is small then this is a leaf

else find the longest bbox length on X, Y or Z

and sort array according to the longest axis

now that we have a sorted array of triangles, we take the bboxes of first and last triangle in the array, and try to set each triangle in the bbox where it fits better. Triangle are taken in this order :

  • 1, n, 2, n-1, 3, n-2 ... Once each triangle has been affected to the first or last bbox, the bbox is updated

at the end, if one of the list is empty, just separate the triangle list in two

else use the list to construct the two sons recursively

Friends And Related Function Documentation

◆ AABBTreeNode


call base class constructor (CollisionBaseObject) and init members

The documentation for this class was generated from the following files: