I have the segmentation results from one algorithm, however, the generated triangle surface is not manifold geometry. I am asking this question here if there is any C++ library that can be used for converting the non-manifold geometry to manifold surfaces?

PS, I have already cleaned the result by filling the holes, but it seems that there are still some non-smoothed parts and holes.

Thanks

1

There are 1 answers

0
Jing Zhao On

If there is any C++ library that can be used for converting the non-manifold geometry to manifold surfaces?

Yes, there is CGAL, the Computational Geometry Algorithms Library.

In CGAL, a polygon mesh is considered to have the topology of a 2-manifold.
And when the faces of a polygon mesh are given but the connectivity is unknown, this set of faces is called a polygon soup. That is to say, all the triangles of your surface will be treated separately.

To convert a non-manifold surface into manifold, you can first load your data into a polygon soup.
Then convert it into a polygon mesh using the function polygon_soup_to_polygon_mesh. The following code snippet from CGAL gives an example:

typedef CGAL::Exact_predicates_inexact_constructions_kernel          K;
typedef CGAL::Polyhedron_3<K, CGAL::Polyhedron_items_with_id_3>      Polyhedron;

std::ifstream input(filename);
std::vector<K::Point_3> points;
std::vector<std::vector<std::size_t> > polygons;
if(!input || !CGAL::read_OFF(input, points, polygons) || points.empty())
{
  std::cerr << "Cannot open file " << std::endl;
  return EXIT_FAILURE;
}
CGAL::Polygon_mesh_processing::orient_polygon_soup(points, polygons);
Polyhedron mesh;
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, polygons, mesh);

Or you can try to repair the surface mesh as depicted in here.