Remove check() and checkNode() methods from DynamicAABBTree in release mode

This commit is contained in:
Daniel Chappuis 2014-07-07 19:01:26 +02:00
parent 4f141b87fb
commit 050b610d8c
3 changed files with 12 additions and 6 deletions

View File

@ -26,6 +26,7 @@
// Libraries
#include "BroadPhaseAlgorithm.h"
#include "../CollisionDetection.h"
#include "../../engine/Profiler.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -27,6 +27,7 @@
#include "DynamicAABBTree.h"
#include "BroadPhaseAlgorithm.h"
#include "../../memory/Stack.h"
#include "../../engine/Profiler.h"
using namespace reactphysics3d;
@ -159,6 +160,8 @@ void DynamicAABBTree::removeObject(int nodeID) {
/// frames.
bool DynamicAABBTree::updateObject(int nodeID, const AABB& newAABB, const Vector3& displacement) {
PROFILE("DynamicAABBTree::updateObject()");
assert(nodeID >= 0 && nodeID < mNbAllocatedNodes);
assert(mNodes[nodeID].isLeaf());
assert(mNodes[nodeID].height >= 0);
@ -333,9 +336,6 @@ void DynamicAABBTree::insertLeafNode(int nodeID) {
}
assert(mNodes[nodeID].isLeaf());
// Check the structure of the tree
check();
}
// Remove a leaf node from the tree
@ -403,9 +403,6 @@ void DynamicAABBTree::removeLeafNode(int nodeID) {
mNodes[siblingNodeID].parentID = TreeNode::NULL_TREE_NODE;
releaseNode(parentNodeID);
}
// Check the structure of the tree
check();
}
// Balance the sub-tree of a given node using left or right rotations.
@ -608,6 +605,8 @@ void DynamicAABBTree::reportAllShapesOverlappingWith(int nodeID, const AABB& aab
}
}
#ifndef NDEBUG
// Check if the tree structure is valid (for debugging purpose)
void DynamicAABBTree::check() const {
@ -678,3 +677,5 @@ void DynamicAABBTree::checkNode(int nodeID) const {
checkNode(rightChild);
}
}
#endif

View File

@ -123,12 +123,16 @@ class DynamicAABBTree {
/// Balance the sub-tree of a given node using left or right rotations.
int balanceSubTreeAtNode(int nodeID);
#ifndef NDEBUG
/// Check if the tree structure is valid (for debugging purpose)
void check() const;
/// Check if the node structure is valid (for debugging purpose)
void checkNode(int nodeID) const;
#endif
public:
// -------------------- Methods -------------------- //