Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] error converting Polyhedron_3 to Nef_polyhedron_3

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] error converting Polyhedron_3 to Nef_polyhedron_3


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] error converting Polyhedron_3 to Nef_polyhedron_3
  • Date: Fri, 29 Mar 2013 09:35:51 +0100
  • Organization: GeometryFactory

Sorry, I was working thinking to HDS which has different level check.

Actually the level 1 in polyhedron checks the boundary so if you didn't
call normalize_border you will have an error.

You first input is a valid polyhedron, but it cannot be directly
converted into a nef polyhedron because each of the two larger facets
does not have its points exactly on a plane. Thus nef is not able to
consider them as a single face.

A solution is to triangulate the polyhedron before feeding nef with it.

About the dangling facet, it was a bug in my viewer.

Sebastien.

On 03/28/2013 06:47 PM, Cody Rose wrote:
Thank you for your reply. I had not through to use higher levels of
checking for is_valid. However, I guess I still don't understand what
those levels do exactly, because when I load the attached simple
rectangular prism into a Polyhedron_3 and call is_valid(true, 1) then
the validation still fails, and I cannot see how it could possibly do that.

I discovered this because I still cannot figure out what's actually
wrong with my original polyhedron - I cannot identify the geometry of
the dangling face you describe. One OFF viewer I've tried renders two
dangling faces, but another does not, and when I manually inspect the
coordinates in the .off they looks fine. I suspect the rendering problem
has to do with the fact that two of my faces are concave, but I can't
imagine that CGAL is having a similar issue.

(Incidentally, loading from the .off directly into a Nef_polyhedron
doesn't help me, because in my actual use case these polyhedrons are
generated in code, not read from a file.)

Thank you,
Cody

On 3/28/2013 12:41 AM, Sebastien Loriot (GeometryFactory) wrote:
Hello,

the polygon is actually invalid
(increase the check level to 3
if (!poly.is_valid(false,3)) {
std::cout << "poly is invalid\n";
}
).

You have a dangling face with make the surface non-manifold.

One solution is to use this:

if (!poly.is_valid(false,3)) {
std::cout << "poly is invalid\n";
stream.open("poly.off");
nef_polyhedron nef;
CGAL::OFF_to_nef_3 (stream, nef);
std::cout << "created nef\n";
}


Sebastien.


On 03/27/2013 09:28 PM, Cody Rose wrote:
Hello,

I receive an assertion failure when trying to convert the attached
polyhedron to a nef polyhedron. The attached sample code demonstrates my
problem. I am running this with CGAL 4.1, Boost 1.47, and LEDA 6.3. I am
not sure if there is something about this polyhedron that causes the
problem, but I could not find anything in the documentation to help me
resolve this issue, and a cursory inspection of the .off doesn't show
anything wrong to me (I'm probably just missing something simple).

The example program out is as follows:

loaded good poly with 16 vertices
CGAL error: assertion violation!
Expression : pe_prev->is_border() ||
internal::Plane_constructor<Plane>::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).

has_on(pe_prev->opposite()->vertex()->point())
File : c:\program files
(x86)\cgal\include\cgal\nef_3\polyhedron_3_to_nef_3.h
Line : 254
Explanation:
Refer to the bug-reporting instructions at
http://www.cgal.org/bug_report.html

Thank you,
Cody Rose









Archive powered by MHonArc 2.6.18.

Top of Page