diff options
Diffstat (limited to 'extern/bullet/Bullet/CollisionDispatch/UnionFind.h')
-rw-r--r-- | extern/bullet/Bullet/CollisionDispatch/UnionFind.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/extern/bullet/Bullet/CollisionDispatch/UnionFind.h b/extern/bullet/Bullet/CollisionDispatch/UnionFind.h index f7e9feb6ea0..8705e579189 100644 --- a/extern/bullet/Bullet/CollisionDispatch/UnionFind.h +++ b/extern/bullet/Bullet/CollisionDispatch/UnionFind.h @@ -17,6 +17,8 @@ subject to the following restrictions: #define UNION_FIND_H ///UnionFind calculates connected subsets +// Implements weighted Quick Union with path compression +// optimization: could use short ints instead of ints (halving memory, would limit the number of rigid bodies to 64k, sounds reasonable) class UnionFind { private: @@ -32,6 +34,15 @@ class UnionFind void reset(int N); + inline int getNumElements() const + { + return m_N; + } + inline bool isRoot(int x) const + { + return (x == m_id[x]); + } + int find(int p, int q); void unite(int p, int q); |