Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] 3D Polyhedrons intersections

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] 3D Polyhedrons intersections


Chronological Thread 
  • From: Peter Hachenberger <>
  • To:
  • Subject: Re: [cgal-discuss] 3D Polyhedrons intersections
  • Date: Wed, 13 Dec 2006 13:03:25 +0100

Can you also sent the input data for which the program crashed.

Peter

On Wed, 2006-12-13 at 10:23 +0100, FEYEL Frederic. wrote:
> First of all, thank you very much for your help. It is a real pleasure
> to see this reactivity !
>
> My program is really simple:
>
> to_cgal(mesh1,P1); to_cgal(mesh2,P2);
>
> if (!P1.is_closed() || !P2.is_closed() ) ERROR("Supplied meshes are
> not closed");
>
> Nef_polyhedron N1(P1);
> Nef_polyhedron N2(P2);
>
> Nef_polyhedron N3;
>
> N3=N1-N2;
> if (!N3.is_simple()) ERROR("Resulting shape is not a 2-manifold");
> N3.convert_to_Polyhedron(P3);
>
>
>
> The to to_cgal(...) methods allows the conversion from my own data
> structure: it constructs the Polyhedron, knowing the surface mesh,
> using the following piece of code:
>
> Build_poly_from_utility_mesh<HalfedgeDS> builder(mesh);
> P.delegate(builder);
>
>
> where the Build_poly_from_utility_mesh contains (all UTILITY_xxxxx
> classes are my datastructures, containing nodes, elements, etc...
> In the test, all those UTILITY_ELEMENT are made of 3-nodes shell elements) :
>
> void operator()( HDS& hds) {
> CGAL::Polyhedron_incremental_builder_3<HDS> B(hds);
>
> B.begin_surface(mesh->nodes.size(),mesh->elements.size());
>
> for (int inode=0;inode<mesh->nodes.size();inode++) {
> VECTOR &pos=mesh->nodes[inode]->position;
> Point p(pos[0],pos[1],pos[2]);
> B.add_vertex(p);
> }
>
> for (int ielem=0;ielem<mesh->elements.size();ielem++) {
> UTILITY_ELEMENT &an_elem=*mesh->elements[ielem];
>
> B.begin_facet();
> for (int inode=0;inode<an_elem.nodes.size();inode++)
> B.add_vertex_to_facet(an_elem.nodes[inode]->give_rank());
> B.end_facet();
> }
>
> B.end_surface();
> }
>
>
> I think that the creation of the Polyhedron works well, because the VRML
> exported file looks ok in an
> independent VRML viewer.
>
> Once again, thank you very much for your help.
>
> Frédéric.
>
>
>
> Andreas Fabri a écrit :
> > Please post your test program if it is short.
> >
> > andreas
> >
> > Frédéric FEYEL wrote:
> >> Thank you for your advice.
> >>
> >> I changed my closed surface so that it contains only 3-nodes
> >> facets, so that all facets are obviously planar.
> >>
> >> However, the same problem is still there:
> >>
> >> CGAL error: assertion violation!
> >> Expr: pe_prev->facet()->plane().
> >> has_on(pe_prev->opposite()->vertex()->point())
> >> File: ./cgal_build/CGAL-3.2.1/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h
> >>
> >> Does anyone has some extra clues ?
> >>
> >> Thank you very much for your help,
> >>
> >> Best Regards,
> >>
> >> Frederic.
> >>
> >> Andreas Fabri a écrit :
> >>> Hello,
> >>>
> >>> When you have facets with more than three vertices they must be
> >>> coplanar, which might not be given if their coordinates are doubles.
> >>> The solution is to either make them coplanar, or to triangulate
> >>> the faces.
> >>>
> >>> best regards,
> >>>
> >>> andreas
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> wrote:
> >>>> Hello,
> >>>>
> >>>> I am very new to CGAL, and I am wondering if it is possible to do
> >>>> solid/solid intersections.
> >>>>
> >>>> It is funny to see that infact, I have the same question as Cedric
> >>>> Le Maitre (he sent a mail today)...
> >>>>
> >>>> More precisely, I have two solids described by two closed Polyhedra
> >>>> (using 3 and 4 nodes faces).
> >>>>
> >>>> I would like to get the Polyhedra that represents the difference
> >>>> between
> >>>> the two solids.
> >>>>
> >>>> I tried using the Nef_polyhedron_3 classes :
> >>>>
> >>>> 1- construct two Polyhedron
> >>>> 2- construct the Nef_polyhedron from the 2 polyhedron
> >>>> 3- intersect the 2 Nef_polyhedron
> >>>> 4- convert the result back to a Polyhedron
> >>>>
> >>>> When I construct the nef associated with one of the Polyhedrons, I
> >>>> get the following error :
> >>>>
> >>>> CGAL error: assertion violation!
> >>>> Expr: pe_prev->facet()->plane().
> >>>> has_on(pe_prev->opposite()->vertex()->point())
> >>>> File:
> >>>> ./cgal_build/CGAL-3.2.1/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h
> >>>> Line: 151
> >>>>
> >>>> I had a look in this file, but the error is not so obvious, at
> >>>> least for
> >>>> a 'CGAL-beginner' like me.
> >>>>
> >>>>
> >>>> Could anyone guide me, and tell me if such operation is available in
> >>>> CGAL, and if yes, how to achieve it ? Any help would be greatly
> >>>> appreciated.
> >>>>
> >>>>
> >>>> Best Regards,
> >>>>
> >>>> Frederic.
> >>>>
> >>>>
> >>>
> >>
> >>
> >>
> >>
> >
>





Archive powered by MHonArc 2.6.16.

Top of Page