An Algorithm for Decomposing Multi-dimensional Non-manifold Objects