Close-to-optimal algorithm for rectangular decomposition of 3D shapes