Skip to main content
. 2022 May 6;22(9):3531. doi: 10.3390/s22093531
Algorithm 1 Algorithm to find a cluster
Require:b>0
Require: firstPoint ∈ pointCloud
  1: while true do
  2:    cluster = createEmptyCluster
  3:    currentPoints = [firstPoint]
  4:    boundingBox = point.coordinates ± b
  5:    newPointsAdded = true
  6:    while newPointsAdded do
  7:       closePoints = fcp(boundingBox,b,root)
  8:       if closePoints.size = 0 then
  9:          newPointsAdded = false
10:       end if
11:       currentPoints ∪= closePoints
12:    end while
13:    return cluster(currentPoints)
14: end while
15: procedure FCP(boundingBox,b,node,result=[])
16:    if node.depth = 0 then
17:       currentLocation = node.location.x
18:    else
19:       if node.depth = 1 then
20:          currentLocation = node.location.y
21:       else
22:          currentLocation = node.location.z
23:       end if
24:    end if
25:    if !node.removed and boundingBox.contains(node) then
26:       result ∪= node
27:       node.removed = true
28:       boundingBox = expand(boundingBox, node, b)
29:    end if
30:    points ∪= fcp(boundingBox,b,node.left,result)
31:    points ∪= fcp(boundingBox,b,node.right,result)
32:    return points
33: end procedure
34: procedureexpand(boundingBox, node, b)
35:    boundingBox.minX = min(boundingBox.minX, node.x−b)
36:    boundingBox.maxX = min(boundingBox.maxX, node.x+b)
37:    boundingBox.minY = min(boundingBox.minY, node.y−b)
38:    boundingBox.maxY = min(boundingBox.maxY, node.y+b)
39:    boundingBox.minZ = min(boundingBox.minZ, node.z−b)
40:    boundingBox.maxZ = min(boundingBox.maxZ, node.z+b)
41: end procedure