Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Problems with Nef_Polyhedron
- Date: Wed, 15 Jun 2011 09:36:57 +0200
If you are using the construction from polyhedron,
nef assumes that the input is a valid polyhedron.
Your input output4.OFF contains facets made only of collinear
points.
The following code detect these facets:
for (Polyhedron::Facet_iterator f=poly.facets_begin();
f!=poly.facets_end();++f)
{
Kernel::Point_3 pt1,pt2,pt3;
pt1=f->halfedge()->vertex()->point();
pt2=f->halfedge()->next()->vertex()->point();
Polyhedron::Halfedge_handle h=f->halfedge()->next();
do{
pt3=f->halfedge()->next()->next()->vertex()->point();
if (! CGAL::collinear(pt1,pt2,pt3) ) break;
h=h->next();
}
while(h!=f->halfedge());
if( h==f->halfedge() )
std::cerr<<"Error degenerate facet" << std::endl;
}
In order to remove this kind of degeneracies, you can use the
function CGAL::OFF_to_nef_3 documented here:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Nef_3_ref/Function_OFF_to_nef_3.html
Using this function I was able to make the union of your
inputs with CGAL-3.8.
Sebastien.
Benjamin McWhorter wrote:
Hello All,
I have been having some trouble correctly joining Nef_Polyhedron. I have
attached some .off files that should recreate the error. I have been trying
to join a large number of Polyhedron using CGAL and ran into many problems
along the way. I found that I cannot simply join the simple and valid
nef_polyhedron and expect a simple and valid result. The only way I was able
to accurately join them was by testing if the result of the join was simple
and valid after checking if there was an intersection and if it passed all
three tests, then perform the join.
It seems that the order in which I joined them had a lot to do with it
working out.
Anyhow, on to my actual issue. I ran the join and expected the following two
polyhedron to be joined, but they were not. After the join I convert back to
Polyhedron and then use the print_polyhedron_wavefront function to write the
output in an .obj file.
These .OFF files that I attached are simply print_polyhedron_wavefront .objs
that I have converted to .OFF. These two were not joined during execution,
however, when I ran the program again with these two as input, I get the
following (sorry if I put too much). I am wondering why CGAL is discarding
facets that were created by the print_polyhedron_wavefront function and 2,
why these two were not joined in the first place. Any help is much
appreciated.
Thanks,
Ben
------------------------------------------------------------------------
output4.OFF
Conversion from vertex cycle to Nef_polyhedron_3 was not successful. Error history: ->
function parameter 'normal' is NULL_VECTOR (this can be a symptom of an error). Now,
direction of projection is 'x'. -> Same vertex appears multiple in cycle. Now,
direction of projection is 'y'. -> Same vertex appears multiple in cycle. Now,
direction of projection is 'z'. -> Same vertex appears multiple in cycle. Finally,
empty Nef_polyhedron_3 was constructed.
Hence, discard input facet 14 (enumerated beginning with 1). Check semantics!
Conversion from vertex cycle to Nef_polyhedron_3 was not successful. Error history: ->
function parameter 'normal' is NULL_VECTOR (this can be a symptom of an error). Now,
direction of projection is 'x'. -> Same vertex appears multiple in cycle. Now,
direction of projection is 'y'. -> Same vertex appears multiple in cycle. Now,
direction of projection is 'z'. -> Same vertex appears multiple in cycle. Finally,
empty Nef_polyhedron_3 was constructed.
Hence, discard input facet 21 (enumerated beginning with 1). Check semantics!
Conversion from vertex cycle to Nef_polyhedron_3 was not successful. Error history:
-> function parameter 'normal' is NULL_VECTOR (this can be a symptom of an
error). Now, direction of projection is 'x'. Now, direction of projection is 'y'.
Now, direction of projection is 'z'. -> Different vertices are projected to same
location! Finally, empty Nef_polyhedron_3 was constructed.
Hence, discard input facet 29 (enumerated beginning with 1). Check semantics!
Conversion from vertex cycle to Nef_polyhedron_3 was not successful. Error history: ->
function parameter 'normal' is NULL_VECTOR (this can be a symptom of an error). Now,
direction of projection is 'x'. -> Same vertex appears multiple in cycle. Now,
direction of projection is 'y'. -> Same vertex appears multiple in cycle. Now,
direction of projection is 'z'. -> Different vertices are projected to same location!
Finally, empty Nef_polyhedron_3 was constructed.
Hence, discard input facet 30 (enumerated beginning with 1). Check semantics!
Conversion from vertex cycle to Nef_polyhedron_3 was not successful. Error history: ->
function parameter 'normal' is NULL_VECTOR (this can be a symptom of an error). Now,
direction of projection is 'x'. -> Same vertex appears multiple in cycle. Now,
direction of projection is 'y'. -> Same vertex appears multiple in cycle. Now,
direction of projection is 'z'. -> Different vertices are projected to same location!
Finally, empty Nef_polyhedron_3 was constructed.
Hence, discard input facet 51 (enumerated beginning with 1). Check semantics!
output4.OFF is simple
output4.OFF is valid
output3.OFF
output3.OFF is simple
output3.OFF is valid
- [cgal-discuss] Problems with Nef_Polyhedron, Benjamin McWhorter, 06/15/2011
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Sebastien Loriot (GeometryFactory), 06/15/2011
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Benjamin McWhorter, 06/15/2011
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Sebastien Loriot (GeometryFactory), 06/15/2011
- Message not available
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Sebastien Loriot (GeometryFactory), 06/15/2011
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Ben McWhorter, 06/15/2011
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Sebastien Loriot (GeometryFactory), 06/16/2011
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Benjamin McWhorter, 06/21/2011
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Ben McWhorter, 06/15/2011
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Sebastien Loriot (GeometryFactory), 06/15/2011
- Message not available
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Sebastien Loriot (GeometryFactory), 06/15/2011
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Benjamin McWhorter, 06/15/2011
- Re: [cgal-discuss] Problems with Nef_Polyhedron, Sebastien Loriot (GeometryFactory), 06/15/2011
Archive powered by MHonArc 2.6.16.