19 template <
typename idxType>
26 idxType Find(idxType
id);
27 void Union(idxType id1, idxType id2);
39 template <
typename idxType>
43 this->uf = VF_ALLOC(node, N);
44 for (idxType i = 0; i < N; i++)
51 template <
typename idxType>
52 CUnionFind<idxType>::~CUnionFind()
57 template <
typename idxType>
58 idxType CUnionFind<idxType>::Find(idxType
id)
60 if (uf[
id].parent !=
id)
62 uf[id].parent = Find(uf[
id].parent);
67 template <
typename idxType>
68 void CUnionFind<idxType>::Union(idxType id1, idxType id2)
75 idxType id1Root = Find(id1);
76 idxType id2Root = Find(id2);
78 if (id1Root == id2Root)
83 if (uf[id1Root].rank < uf[id2Root].rank)
85 uf[id1Root].parent = id2Root;
88 else if (uf[id1Root].rank > uf[id2Root].rank)
90 uf[id2Root].parent = id1Root;
95 uf[id2Root].parent = id1Root;
100 template <
typename idxType>
101 void CUnionFind<idxType>::Reset()
103 for (idxType i = 0; i < this->size; i++)
110 typedef CUnionFind<uint16_t> CUnionFind16;
111 typedef CUnionFind<uint32_t> CUnionFind32;
Contains all classes and functions for the VoxelFarm engine.