Research Article

Efficient Boundary Extraction from Orthogonal Pseudo-Polytopes: An Approach Based on the 𝑛 D-EVM

Algorithm 3

Connected component labeling over an D-OPP expressed in the D-EVM.
Input: An D-OPP .
    The number of dimensions.
Output: A list containing the EVMs which describe the D components of .
Procedure ConnectedComponentsLabeling(EVM , int )
    if( ) then
     return ConnectedComponentsLabeling1D // Base case.
    else
     EVM hvl     // Current couplet of p.
     EVM ,      // Previous and next sections about hvl.
      = InitEVM( )
     List components  // The components of section .
     List indexes    // A list of indexes.
     List components   // The components of section .
     List indexes   // A list of indexes.
     List componentsP // The D components of input polytope p.
     CoordType currCoord = getCoordNextHvl
     hvl = ReadHvl
     CoordType nextCoord = getCoordNextHvl
     while(Not(EndEVM ))
        = GetSection( , hvl)
       components = ConnectedComponentsLabeling // Recursive call.
       for(int , j < Size(components ), )
         EVM = components
         boolean withoutComponent = true
         for(int , i < Size(components ), )
           EVM = components
           EVM c = BooleanOperation( , , Intersection, )
           if(Not(IsEmpty(c)) and (withoutComponent = true)) then
             // CASE 1
             withoutComponent = false
             List componentToUpdate = componentsP(indexes )
             Append(componentToUpdate, , currCood, nextCoord})
             Append(indexes , indexes )
           else if(Not(IsEmpty(c)) and (withoutComponent = false)) then
             // CASE 2
             if(indexes β‰  indexes ) then
               List component1 = componentsP(indexes )
               List component2 = componentsP(indexes )
               for(int , k < Size(component1), )
                 Append(component2, component1( ))
               end-of-for
               Update(componentsP, indexes , NULL)
               for(int , k < Size(indexes ), )
                 if(indexes = indexes ) then
                   Update(indexes , k, indexes )
                 end-of-if
               end-of-for
               for(int , k < Size(indexes ), )
                 if(indexes = indexes ) then
                   Update(indexes , k, indexes )
                 end-of-if
               end-of-for
               Update(indexes , i, indexes )
             end-of-if
           end-of-if
          end-of-for
          if(withoutComponent = true) then
            // CASE 3
            List newComponent
            Append(newComponent, , currCoord, nextCoord})
            Append(componentsP, newComponent)
            Append(indexes , Size(componentsP) - 1)
          end-of-if
         end-of-for
         
         components = components
         indexes = indexes
         currCoord = GetCoordNextHvl
         hvl = ReadHvl // Read next couplet.
nextCoord = GetCoordNextHvl
end-of-while
// End of sections’ processing.
int
while(i < Size(componentsP))
  if(componentsP(i) = NULL) then
    Remove(componentsP, i)
    
  else
    List currentListOfSections = componentsP(i)
    EVM evmComponent = getEVMforListOfSections(currentListOfSections, )
    Update(componentsP, , evmComponent)
  end-of-if
  
  end-of-while
  return componentsP
 end-of-if
end-of-procedure