16 #ifndef BT_UNION_FIND_H
17 #define BT_UNION_FIND_H
21 #define USE_PATH_COMPRESSION 1
24 #define STATIC_SIMULATION_ISLAND_OPTIMIZATION 1
52 return int(m_elements.
size());
56 return (
x == m_elements[
x].m_id);
61 return m_elements[index];
65 return m_elements[index];
82 #ifndef USE_PATH_COMPRESSION
84 if (m_elements[i].m_sz < m_elements[j].m_sz)
86 m_elements[i].m_id = j;
87 m_elements[j].m_sz += m_elements[i].m_sz;
91 m_elements[j].m_id = i;
92 m_elements[i].m_sz += m_elements[j].m_sz;
95 m_elements[i].m_id = j;
96 m_elements[j].m_sz += m_elements[i].m_sz;
105 while (
x != m_elements[
x].m_id)
109 #ifdef USE_PATH_COMPRESSION
110 const btElement* elementPtr = &m_elements[m_elements[
x].m_id];
111 m_elements[
x].m_id = elementPtr->
m_id;
112 x = elementPtr->
m_id;
114 x = m_elements[
x].m_id;
#define SIMD_FORCE_INLINE
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
UnionFind calculates connected subsets.
const btElement & getElement(int index) const
SIMD_FORCE_INLINE int getNumElements() const
btElement & getElement(int index)
SIMD_FORCE_INLINE bool isRoot(int x) const