Now the method in the unionFind function is similar. Each node in the tree corresponds to one voxel of the voxel space. The tree array contains all indices to the perent node of the tree. The tree is initialied with NULL pinter equivalents (-1 in this case) then we loop over all voxels and all neighbors of a voxel ar found and the corresponding trees are unified.
In the end all nodes that are somehow connected are within a single tree within the forrest.
The 2 functions that use this function now evaluate the tree forrest in 2 ways:
The voxel_c::connected function will check if all non empty voxels in the space are within the same tree
The voxel_c::fillHoles function uses the unionFind function differently. It lets the function connect the empty voxels instead of the filled. Now we will find isolated voids because they are in separate trees.