CGAL_Build_PolySet build until manifold (then begin new surface)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CGAL_Build_PolySet build until manifold (then begin new surface)

clothbot
Hi Clifford and Marius,

Pulling on some threads in the code, I've found that import_stl builds a PolySet, which in turn calls render_cgal_nef_polyhedron, which instantiates CGAL_Build_PolySet, which ultimately makes use of CGAL::Polyhedron_incremental_builder_3 functions.

Scanning through CGAL/Polyhedron_incremental_builder_3.h, I noticed a few class functions that could prove useful for tightening up the import code:

- test_facet --> calls test_facet_indices: appears to test if a facet can be inserted without creating non-manifoldness in the surface.

- check_unconnected_vertices/remove_unconnected_vertices: identify and handle incomplete geometry.

The "test_facet" functions might be useful for adding facets until a manifold condition or the end of imported geometry is reached. Roughly in pseudo code:

begin_surface();
for( i=0; i++; i<polygons.size() ) {
  if( test_facet(facet[i] ) && i < polygons.size()-1 ) {
    add_facet(facet[i]);
    end_surface();
    begin_surface();
  } else {
    add_facet(facet[i]);
  }
}
end_surface();


Depending on how greatly unconnected vertices interfere with CGAL/CSG operations further down the line, the check_/remove_unconnected_vertices may be useful to use at the end of import to clean up, identify, debug, and perhaps fix incomplete geometry.

Andrew.

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/