diff --git a/Bullet/BroadphaseCollision/AxisSweep3.cpp b/Bullet/BroadphaseCollision/AxisSweep3.cpp index 33b376277..c0f16c8ee 100644 --- a/Bullet/BroadphaseCollision/AxisSweep3.cpp +++ b/Bullet/BroadphaseCollision/AxisSweep3.cpp @@ -212,7 +212,10 @@ void AxisSweep3::RemoveHandle(unsigned short handle) { Handle* pHandle = GetHandle(handle); - //RemoveOverlappingPairsContainingProxy(pHandle); + //explicitly remove the pairs containing the proxy + //we could do it also in the SortMinUp (passing true) + //todo: compare performance + RemoveOverlappingPairsContainingProxy(pHandle); // compute current limit of edge arrays diff --git a/Bullet/CollisionDispatch/UnionFind.cpp b/Bullet/CollisionDispatch/UnionFind.cpp index e099408db..f7f4895a7 100644 --- a/Bullet/CollisionDispatch/UnionFind.cpp +++ b/Bullet/CollisionDispatch/UnionFind.cpp @@ -26,29 +26,17 @@ UnionFind::~UnionFind() } UnionFind::UnionFind() -:m_elements(0), -m_N(0) { } void UnionFind::Allocate(int N) { - if (m_N < N) - { - //Free(); //not necessary with stl vectors - - m_N = N; - m_elements.resize(N);// = new Element[N]; - } + m_elements.resize(N); } void UnionFind::Free() { - if (m_N) - { - m_N=0; - m_elements.clear(); - } + m_elements.clear(); } @@ -56,7 +44,7 @@ void UnionFind::reset(int N) { Allocate(N); - for (int i = 0; i < m_N; i++) + for (int i = 0; i < N; i++) { m_elements[i].m_id = i; m_elements[i].m_sz = 1; } diff --git a/Bullet/CollisionDispatch/UnionFind.h b/Bullet/CollisionDispatch/UnionFind.h index 9792096a5..ac7071bed 100644 --- a/Bullet/CollisionDispatch/UnionFind.h +++ b/Bullet/CollisionDispatch/UnionFind.h @@ -30,7 +30,6 @@ class UnionFind { private: std::vector m_elements; - int m_N; public: @@ -46,7 +45,7 @@ class UnionFind inline int getNumElements() const { - return m_N; + return m_elements.size(); } inline bool isRoot(int x) const {