Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] CGAL difference on Nef_polyhedron produces shape with duplicate vertices

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] CGAL difference on Nef_polyhedron produces shape with duplicate vertices


Chronological Thread 
  • From: crobar <>
  • To:
  • Subject: Re: [cgal-discuss] CGAL difference on Nef_polyhedron produces shape with duplicate vertices
  • Date: Mon, 15 Sep 2014 05:58:29 -0700 (PDT)

To be honest, it also surprises me. I have attached two .OFF files which I
wrote out from CGAL, just prior to performing the boolean operation. These
are a cube and a sphere.

I subtract the sphere from the box. When I do this, and then run the
resulting shape through the mesh simplification discussed previously I get
the following results:

252sqrt aCurrentCost Is 5.10207e-18 _tol is 1e-08


252sqrt aCurrentCost Is 1.0065e-17 _tol is 1e-08


252sqrt aCurrentCost Is 1.47533e-17 _tol is 1e-08


252sqrt aCurrentCost Is 1.49587e-17 _tol is 1e-08


252sqrt aCurrentCost Is 1.68221e-17 _tol is 1e-08


252sqrt aCurrentCost Is 1.73215e-17 _tol is 1e-08


252sqrt aCurrentCost Is 1.86195e-17 _tol is 1e-08


252sqrt aCurrentCost Is 1.90392e-17 _tol is 1e-08


252sqrt aCurrentCost Is 1.96004e-17 _tol is 1e-08


252sqrt aCurrentCost Is 2.11169e-17 _tol is 1e-08


252sqrt aCurrentCost Is 2.28058e-17 _tol is 1e-08


252sqrt aCurrentCost Is 2.39854e-17 _tol is 1e-08


252sqrt aCurrentCost Is 2.59503e-17 _tol is 1e-08


252sqrt aCurrentCost Is 2.8387e-17 _tol is 1e-08


252sqrt aCurrentCost Is 2.8972e-17 _tol is 1e-08


252sqrt aCurrentCost Is 2.99057e-17 _tol is 1e-08


252sqrt aCurrentCost Is 3.00493e-17 _tol is 1e-08


252sqrt aCurrentCost Is 3.02278e-17 _tol is 1e-08


252sqrt aCurrentCost Is 3.08919e-17 _tol is 1e-08


252sqrt aCurrentCost Is 3.08919e-17 _tol is 1e-08


252sqrt aCurrentCost Is 3.17361e-17 _tol is 1e-08


252sqrt aCurrentCost Is 3.22802e-17 _tol is 1e-08


252sqrt aCurrentCost Is 3.3361e-17 _tol is 1e-08


252sqrt aCurrentCost Is 3.52399e-17 _tol is 1e-08


252sqrt aCurrentCost Is 3.54382e-17 _tol is 1e-08


252sqrt aCurrentCost Is 3.55536e-17 _tol is 1e-08


252sqrt aCurrentCost Is 0.0257483 _tol is 1e-08

Edges collected: 252
Edges processed: 27
Edges collapsed: 0

Edges not collapsed due to topological constraints: 2
Edge not collapsed due to cost computation constraints: 0
Edge not collapsed due to placement computation constraints: 0

Finished...
0 edges removed.
252 final edges.


So even this shape has edges that cannot be collapsed. I can import these
two OFF files into FreeCAD (based on OpenCASCADE) and perform the boolean
operation. Exporting the cube and sphere from FreeCAD results in shapes with
the same number of faces and vertices as the originals, implying to me that
there is nothing unusual or problematic about these shapes which FreeCAD is
repairing somehow.

I wrote out the OFF files using the following function and the union is
performed immediately after (just to show everything happens in CGAL, and
does not seem to be introduced by my code):

void off_write (Polyhedron P)
{
// Write polyhedron in Object File Format (OFF).
CGAL::set_ascii_mode( std::cout);
std::cout << "OFF" << std::endl
<< P.size_of_vertices()
<< ' '
<< P.size_of_facets()
<< " 0" << std::endl;

std::copy( P.points_begin(), P.points_end(),
std::ostream_iterator<Point>( std::cout, "\n"));

for ( Facet_iterator i = P.facets_begin(); i != P.facets_end(); ++i)
{
Halfedge_facet_circulator j = i->facet_begin();
// Facets in polyhedral surfaces are at least triangles.
CGAL_assertion( CGAL::circulator_size(j) >= 3);
std::cout << CGAL::circulator_size(j) << ' ';
do
{
std::cout << ' ' << std::distance(P.vertices_begin(),
j->vertex());
}
while ( ++j != i->facet_begin());
std::cout << std::endl;
}

}

I'm using CGAL 4.4 in case it is relevant.

cgal_box_triagulated_by_cgal.off
<http://cgal-discuss.949826.n4.nabble.com/file/n4659841/cgal_box_triagulated_by_cgal.off>


sphere_triangulated_by_cgal.off
<http://cgal-discuss.949826.n4.nabble.com/file/n4659841/sphere_triangulated_by_cgal.off>






--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/CGAL-difference-on-Nef-polyhedron-produces-shape-with-duplicate-vertices-tp4659760p4659841.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page