| Algorithm 1. Converting the 2D mesh to a tunnel-shaped mesh |
| Input: raw point cloud R (x, y, z); meshed plane point cloud P (x, y, 2.75) |
| Output: tunnel-shaped mesh T (x, y, z) |
| 1: R (θ, y, ρ) ← Switch Cartesian coordinates R (x, y, z) to polar coordinates |
| 2: P′ (x′, y′, z′) ← Roll up the plane data P (x, y, 2.75) to cylindrical data |
| 3: P″ (θ″, y″, ρ″) ← Switch Cartesian coordinates P′ (x′, y′, z′) to polar |
| 4: for each point P″i (θ″i, y″i, ρ″i) do |
| 5: Extract the set Nk (θ, y, ρ) from R (θ, y, ρ) ← k nearest neighbors of θ″i where | y″i − y | < m |
| 6: Compute the average ρki from Nk (θ, y, ρ) |
| 7: Ti (xi, yi, zi) ← Switch polar coordinates (θ″i, y″i, ρki) to Cartesian coordinates |
| 8: end for |
| 9: return T |