#include <BspTree.h>
Public Member Functions | |
| BspTree () | |
| Standard constructor. | |
| BspTree (const BspTree &source) | |
| Copy constructor. | |
| BspTree (struct Particle *object) | |
| Constructor for creting a new leaf. | |
| ~BspTree () | |
| Destructor (if you want to free memory of content, call whipe() first). | |
| void | push_back (struct Particle *object) |
| Adds a new object to the tree. | |
| void | del (struct Particle *object) |
| Deletes a object from the tree. | |
| void | whipe () |
| Frees memory from all stored objects. | |
| Uint32 | size () |
| Returns the size of tree. | |
| vector< struct Particle * > | traverse (const Vector &vertex, const Vector &dir, const Uint32 &time) const |
| Returns the content of the tree sorted by a given vertex and vector at a given time. | |
| vector< struct Particle * > | traverse (const Vector &vertex, const Vector &dir) const |
| Returns the content of the tree sorted by a given vertex and vector. | |
| vector< struct Particle * > | traverse () const |
| Returns the unsorted content of the tree. | |
| const Vector | getPlaneNormal () const |
| Getter for plane normal. | |
| void | setPlaneNormal (const Vector &planeNormal) |
| Setter for plane normal. | |
| const GLfloat | getPlaneDistance () const |
| Getter for plane distance. | |
| void | setPlaneDistance (const GLfloat &planeDistance) |
| Setter for plane distance. | |
| const bool | isLeaf () const |
| Getter for leaf property. | |
| void | setLeaf (const bool &leaf) |
| Setter for leaf property. | |
| BspTree * | getPosChild () const |
| Getter for positive child. | |
| void | setPosChild (BspTree *posChild) |
| Setter for positive child. | |
| BspTree * | getNegChild () const |
| Getter for negative child. | |
| void | setNegChild (BspTree *negChild) |
| Setter for negative child. | |
| struct Particle * | getLeafContent () const |
| Getter for leaf content. | |
| void | setLeafContent (struct Particle *content) |
| Setter for leaf content. | |
| const bool | isVisited () const |
| Getter for visited flag. | |
| const bool | isUnvisited () const |
| Getter for visited flag. | |
| void | setVisited (const bool &visited) |
| Setter for visited flag. | |
| const GLfloat | getMaxDistance () const |
| Getter for maxDistance. | |
| void | setMaxDistance (const GLfloat &maxDistance) |
| Setter for plane distance. | |
Private Member Functions | |
| bool | isOnPositiveSide (struct Particle *object) |
| Checks if the object is on the plane or its positive side. | |
| bool | isOnPositiveSide (const Vector &vertex) const |
| Checks if the vertex is on the plane or its positive side. | |
| void | resetVisited () |
| Resets all visited attributes. | |
| void | resetMaxDistance () |
| Resets all max distance attributes. | |
| void | calcMaxDistance (const Vector &vertex, const Vector &dir) |
| Calculates all max distance attributes. | |
| void | calcMaxDistance (const Vector &vertex, const Vector &dir, const Uint32 &time) |
| Calculates all max distance attributes for a given time. | |
Private Attributes | |
| Vector | planeNormal |
| Plane normal for inner nodes. | |
| GLfloat | planeDistance |
| Plane distance to origin for inner nodes. | |
| BspTree * | posChild |
| The subtree in the direction (>=0) of the plane normal. | |
| BspTree * | negChild |
| The subtree in the opposite direction (<0) relative to the plane normal. | |
| bool | leaf |
| Indicates if the node is a leaf and has no children. | |
| struct Particle * | leafContent |
| The content stored in a leaf. | |
| bool | visited |
| Needed for traversal. | |
| GLfloat | maxDistance |
| Needed for sorting. | |
This implementation of a BSP-Tree enables sorting by position for any Animatable object. It is intended to replace the STD::List for all purposes that are related to 3-space operations.
| BspTree::BspTree | ( | ) |
Standard constructor.
Creates a new BSP-Tree.
| BspTree::BspTree | ( | const BspTree & | source | ) |
Copy constructor.
Creates a copy of the source BSP-Tree. Note: The content will not be dublicated.
| source | The original Tree to be cloned |
| BspTree::BspTree | ( | struct Particle * | object | ) |
Constructor for creting a new leaf.
Creates a new leaf with the provided content
| object | The content of the new leaf |
| BspTree::~BspTree | ( | ) |
Destructor (if you want to free memory of content, call whipe() first).
Note: The content will not be destroyed.
| bool BspTree::isOnPositiveSide | ( | struct Particle * | object | ) | [private] |
Checks if the object is on the plane or its positive side.
| object | The object to be checked |
| bool BspTree::isOnPositiveSide | ( | const Vector & | vertex | ) | const [private] |
Checks if the vertex is on the plane or its positive side.
| object | The object to be checked |
| void BspTree::resetVisited | ( | ) | [private] |
Resets all visited attributes.
Resets all visited Attributes in this Tree for traversal.
| void BspTree::resetMaxDistance | ( | ) | [private] |
Resets all max distance attributes.
Resets all maxDistance Attributes in this Tree for traversal.
Calculates all max distance attributes.
Claculates all maxDistance Attributes in this Tree for traversal.
| void BspTree::calcMaxDistance | ( | const Vector & | vertex, | |
| const Vector & | dir, | |||
| const Uint32 & | time | |||
| ) | [private] |
Calculates all max distance attributes for a given time.
| void BspTree::push_back | ( | struct Particle * | object | ) |
Adds a new object to the tree.
| void BspTree::del | ( | struct Particle * | object | ) |
Deletes a object from the tree.
| void BspTree::whipe | ( | ) |
Frees memory from all stored objects.
Collapses the tree and frees the memory of all stored content. Only this node as root will survive.
| Uint32 BspTree::size | ( | ) |
Returns the size of tree.
| vector< struct Particle * > BspTree::traverse | ( | const Vector & | vertex, | |
| const Vector & | dir, | |||
| const Uint32 & | time | |||
| ) | const |
Returns the content of the tree sorted by a given vertex and vector at a given time.
Returns the content of the tree sorted by a given vertex and vector.
| vector< struct Particle * > BspTree::traverse | ( | ) | const |
Returns the unsorted content of the tree.
| const Vector BspTree::getPlaneNormal | ( | ) | const |
Getter for plane normal.
| void BspTree::setPlaneNormal | ( | const Vector & | planeNormal | ) |
Setter for plane normal.
| const GLfloat BspTree::getPlaneDistance | ( | ) | const |
Getter for plane distance.
| void BspTree::setPlaneDistance | ( | const GLfloat & | planeDistance | ) |
Setter for plane distance.
| const bool BspTree::isLeaf | ( | ) | const |
Getter for leaf property.
| void BspTree::setLeaf | ( | const bool & | leaf | ) |
Setter for leaf property.
| BspTree * BspTree::getPosChild | ( | ) | const |
Getter for positive child.
| void BspTree::setPosChild | ( | BspTree * | posChild | ) |
Setter for positive child.
| BspTree * BspTree::getNegChild | ( | ) | const |
Getter for negative child.
| void BspTree::setNegChild | ( | BspTree * | negChild | ) |
Setter for negative child.
| struct Particle * BspTree::getLeafContent | ( | ) | const [read] |
Getter for leaf content.
| void BspTree::setLeafContent | ( | struct Particle * | content | ) |
Setter for leaf content.
| const bool BspTree::isVisited | ( | ) | const |
Getter for visited flag.
| const bool BspTree::isUnvisited | ( | ) | const |
Getter for visited flag.
| void BspTree::setVisited | ( | const bool & | visited | ) |
Setter for visited flag.
| const GLfloat BspTree::getMaxDistance | ( | ) | const |
Getter for maxDistance.
Getter for max distance.
| void BspTree::setMaxDistance | ( | const GLfloat & | maxDistance | ) |
Setter for plane distance.
Setter for max distance.
Vector BspTree::planeNormal [private] |
Plane normal for inner nodes.
GLfloat BspTree::planeDistance [private] |
Plane distance to origin for inner nodes.
BspTree* BspTree::posChild [private] |
The subtree in the direction (>=0) of the plane normal.
BspTree* BspTree::negChild [private] |
The subtree in the opposite direction (<0) relative to the plane normal.
bool BspTree::leaf [private] |
Indicates if the node is a leaf and has no children.
struct Particle* BspTree::leafContent [read, private] |
The content stored in a leaf.
bool BspTree::visited [private] |
Needed for traversal.
GLfloat BspTree::maxDistance [private] |
Needed for sorting.
1.5.6