BVH Class Referenceabstract

## Detailed Description

Bounding Volume Hierarchy class.

`#include <cyBVH.h>`

Inheritance diagram for BVH:

## Constructor and destructor | |

BVH () | |

the tree structure that keeps all the node data (nodeData[0] is not used for cache coherency) | |

virtual | ~BVH () |

the tree structure that keeps all the node data (nodeData[0] is not used for cache coherency) | |

unsigned int | GetRootNodeID () const |

Returns the index of the root node. | |

float const * | GetNodeBounds (unsigned int nodeID) const |

Returns the bounding box of the node as 6 float values. The first 3 values are the minimum x, y, and z coordinates and the last 3 values are the maximum x, y, and z coordinates of the box. | |

bool | IsLeafNode (unsigned int nodeID) const |

Returns true if the node is a leaf node. | |

unsigned int | GetFirstChildNode (unsigned int parentNodeID) const |

Returns the index of the first child node (parent must be an internal node). | |

unsigned int | GetSecondChildNode (unsigned int parentNodeID) const |

Returns the index of the second child node (parent must be an internal node). | |

unsigned int | GetSiblingNode (unsigned int firstChildNodeID) const |

Given the first child node index, returns the index of the second child node. | |

void | GetChildNodes (unsigned int parent, unsigned int &child1, unsigned int &child2) const |

Returns the child nodes of the given node (parent must be an internal node). | |

unsigned int | GetNodeElementCount (unsigned int nodeID) const |

Returns the number of elements inside the given node (must be a leaf node). | |

unsigned int const * | GetNodeElements (unsigned int nodeID) const |

Returns the list of element inside the given node (must be a leaf node). | |

void | Clear () |

Clears the tree structure. | |

void | Build (unsigned int numElements, unsigned int maxElementsPerNode=CY_BVH_MAX_ELEMENT_COUNT) |

Builds the tree structure by recursively splitting the nodes. maxElementsPerNode cannot be larger than 8. | |

virtual void | GetElementBounds (unsigned int i, float box[6]) const =0 |

Sets box as the i^th element's bounding box. | |

virtual float | GetElementCenter (unsigned int i, int dimension) const =0 |

Returns the center of the i^th element in the given dimension. | |

virtual unsigned int | FindSplit (unsigned int elementCount, unsigned int *elements, float const *box, unsigned int maxElementsPerNode) |

Sorts the given elements of a temporary node while building the BVH hierarchy, such that first N elements are to be assigned to the first child and the remaining elements are to be assigned to the second child node, then returns N. Returns zero, if the node is not to be split. The default implementation splits the temporary node down the middle of the widest axis of its bounding box. | |