Topologically correct skeleton in n-D