com.bulletphysics.collision.dispatch
Class UnionFind

java.lang.Object
  extended by com.bulletphysics.collision.dispatch.UnionFind

public class UnionFind
extends Object

UnionFind calculates connected subsets. Implements weighted Quick Union with path compression.


Nested Class Summary
static class UnionFind.Element
           
 
Constructor Summary
UnionFind()
           
 
Method Summary
 void allocate(int N)
           
 int find(int x)
           
 int find(int p, int q)
           
 void free()
           
 UnionFind.Element getElement(int index)
           
 int getNumElements()
           
 boolean isRoot(int x)
           
 void reset(int N)
           
 void sortIslands()
          This is a special operation, destroying the content of UnionFind.
 void unite(int p, int q)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnionFind

public UnionFind()
Method Detail

sortIslands

public void sortIslands()
This is a special operation, destroying the content of UnionFind. It sorts the elements, based on island id, in order to make it easy to iterate over islands.


reset

public void reset(int N)

getNumElements

public int getNumElements()

isRoot

public boolean isRoot(int x)

getElement

public UnionFind.Element getElement(int index)

allocate

public void allocate(int N)

free

public void free()

find

public int find(int p,
                int q)

unite

public void unite(int p,
                  int q)

find

public int find(int x)