Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] CGAL and valgrind

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] CGAL and valgrind


Chronological Thread 
  • From: Sylvain Pion <>
  • To:
  • Subject: Re: [cgal-discuss] CGAL and valgrind
  • Date: Sun, 30 Nov 2008 16:39:43 +0100
  • Organization: INRIA

Jens K. Becker wrote:
Hi all,

I am very happy to give any information you need to solve the problem (and am
quite sure that in the end I did something wrong somewhere). Here is what I am
trying to do:

1. Make a polyhedron
2. Delete all halfedges that separate facets that are in one plane
- check if the facet halfedge->facet() and halfedge->opposite()->facet() are
coplanar
- if they are, use join_facet(halfedge) to delete the corresponding edge and
therewith merge the two facets
3. Retriangulate the polyhedron so that each facet is a triangle

all of that using:
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
(me and Gmpq do not work together very well so I try with doubles)

This works OUTSIDE of valgrind only if the polyhedra are cubes. If they are
anything else, it works only INSIDE of valgrind.

If I start the program OUTSIDE of valgrind, it stops with:

CGAL error: precondition violation!
Expr: circulator_size(h->vertex_begin()) >= size_type(3)
File: /home/jkbecker/Code/eKolos/src/eKolos/core/aPolyhedron_3.h
Line: 1196
Explanation:
terminate called after throwing an instance of 'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: circulator_size(h->vertex_begin()) >= size_type(3)
File: /home/jkbecker/Code/eKolos/src/eKolos/core/aPolyhedron_3.h
Line: 1196

CGAL probably produces antennas and at a later stage bails out because of it.

INSIDE of valgrind, it works fine.

The polyhedra check out ok using p.is_valid(), they fail the higher tests
(p.is_valid(true,1)), but I am not sure about the real meaning of this yet (I
will send output if needed).

Depending on how the coplanarity test is performed, you may internally use
geometric constructions. I'm not that familiar with the Polyhedron, but I
believe it stores a plane in each facet, and constructing a plane from
the vertices is a construction. Therefore you may run into a robustness
issue that involves constructions, requiring exact constructions, so
either Cartesian<Gmpq>, or the hopefully faster
Exact_predicates_exact_constructions_kernel (EPECK).
Note that converting between Gmpq (or the exact number type of the EPECK
kernel) to double can easily be done with the CGAL::to_double function.

Another approach may be to not rely on the plane, and perform coplanarity
tests based only on points, which uses only a predicate, and therefore the
Exact_predicates_inexact_constructions_kernel (EPICK) might be enough to
ensure robustness.

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature




Archive powered by MHonArc 2.6.16.

Top of Page