summaryrefslogtreecommitdiff
path: root/thirdparty/bullet/BulletCollision/CollisionDispatch/btUnionFind.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/bullet/BulletCollision/CollisionDispatch/btUnionFind.cpp')
-rw-r--r--thirdparty/bullet/BulletCollision/CollisionDispatch/btUnionFind.cpp50
1 files changed, 21 insertions, 29 deletions
diff --git a/thirdparty/bullet/BulletCollision/CollisionDispatch/btUnionFind.cpp b/thirdparty/bullet/BulletCollision/CollisionDispatch/btUnionFind.cpp
index 5222933595..816bf1e6ad 100644
--- a/thirdparty/bullet/BulletCollision/CollisionDispatch/btUnionFind.cpp
+++ b/thirdparty/bullet/BulletCollision/CollisionDispatch/btUnionFind.cpp
@@ -15,68 +15,60 @@ subject to the following restrictions:
#include "btUnionFind.h"
-
-
btUnionFind::~btUnionFind()
{
Free();
-
}
btUnionFind::btUnionFind()
-{
-
+{
}
-void btUnionFind::allocate(int N)
+void btUnionFind::allocate(int N)
{
m_elements.resize(N);
}
-void btUnionFind::Free()
+void btUnionFind::Free()
{
m_elements.clear();
}
-
-void btUnionFind::reset(int N)
+void btUnionFind::reset(int N)
{
allocate(N);
- for (int i = 0; i < N; i++)
- {
- m_elements[i].m_id = i; m_elements[i].m_sz = 1;
- }
+ for (int i = 0; i < N; i++)
+ {
+ m_elements[i].m_id = i;
+ m_elements[i].m_sz = 1;
+ }
}
-
class btUnionFindElementSortPredicate
{
- public:
-
- bool operator() ( const btElement& lhs, const btElement& rhs ) const
- {
- return lhs.m_id < rhs.m_id;
- }
+public:
+ bool operator()(const btElement& lhs, const btElement& rhs) const
+ {
+ return lhs.m_id < rhs.m_id;
+ }
};
///this is a special operation, destroying the content of btUnionFind.
///it sorts the elements, based on island id, in order to make it easy to iterate over islands
-void btUnionFind::sortIslands()
+void btUnionFind::sortIslands()
{
-
//first store the original body index, and islandId
int numElements = m_elements.size();
-
- for (int i=0;i<numElements;i++)
+
+ for (int i = 0; i < numElements; i++)
{
m_elements[i].m_id = find(i);
#ifndef STATIC_SIMULATION_ISLAND_OPTIMIZATION
m_elements[i].m_sz = i;
-#endif //STATIC_SIMULATION_ISLAND_OPTIMIZATION
+#endif //STATIC_SIMULATION_ISLAND_OPTIMIZATION
}
-
- // Sort the vector using predicate and std::sort
- //std::sort(m_elements.begin(), m_elements.end(), btUnionFindElementSortPredicate);
- m_elements.quickSort(btUnionFindElementSortPredicate());
+ // Sort the vector using predicate and std::sort
+ //std::sort(m_elements.begin(), m_elements.end(), btUnionFindElementSortPredicate);
+ m_elements.quickSort(btUnionFindElementSortPredicate());
}