Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Plane equations and cartesian<double> kernel

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Plane equations and cartesian<double> kernel


Chronological Thread 
  • From: "Jens K. Becker" <>
  • To:
  • Subject: Re: [cgal-discuss] Plane equations and cartesian<double> kernel
  • Date: Thu, 2 Oct 2008 10:58:58 +0200

I just repeat a first answer that I got here (since I forgot to change the
subject it is now in a different thread):

Please start a new thread (with a new title), when you want to talk about
something different from the thread subject!

The answer came from Laurent Rineau:

That is a FAQ. You use a kernel with non-exact predicates, and that can lead
to crashes. See http://www.cgal.org/FAQ.html#inexact_NT



I tried different Kernels types (including
Exact_predicates_inexact_constructions_kernel) but the problem remains.

I am currently thinking of mixing things (Homogeneous<Gmpz> for triangulation
related stuff, Cartesian<double> for the rest). Is that a good idea? I dont
want to use Homogeneous<Gmpz> for everything because I need to do a lot of
calculations (sqrt, cos, acos, areas etc.) and there seems to be a general
problem with me and Gmpz, we just don't get along very well....

Jens

Quoting "Jens K. Becker"
<>:

Hi all,


Sorry for this double posting, I forgot to change the subject...


I have a problem with polyhedra. I have a single polyhedra which I put together
from points from a Delaunay-Triangulation. This leaves me with a polyhedra that
only has triangles as facets. I need to have a polyhedra where all incident
facets that are in the same plane are merged. I had a code (see below) that
does that and it worked nicely using a homogeneous kernel with Gmpz. Now I have
changed the kernel to be Cartesian<double> and the function does not work
anymore. It crashes when I try to delete a halfedge (therewith merging two
facets), the error-message is:

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

If I run the program a couple of times (using the same polyhedra), it always
crashes at a different polyhedron, not always at the same one. However, the
ones it does process are not done correctly. I suspect a problem with the plane
equation and the number-type and/or kernel-type...

The code first compares the plane equation of twofacets. If it is the same, they
are in the same plane and therefore should be merged. I then cycle through the
halfedges of one of the facets to see which one I need to remove to merge the
facets. Any ideas?

Thanks for your help,

Jens Becker


Here is the code of the function. It just gets a pointer to the polyhedron.:

// FIXME: This loops through the polygon a lot, that can probably be done much
faster. But then who cares, as long as it is only done to get the initial
structure...
void TopoCheck::DeleteAllInternals(Polyhedron *p)
{
//do this for all facets of the polyhedron
Facet_iterator
f1=p->facets_begin(),f2=p->facets_begin(),fend=p->facets_end();
Halfedge_facet_circulator hfc;
bool a;
while(f1!=p->facets_end())
{
while(f2!=p->facets_end())
{
a=false;
//if the points of both facets lie in the same plane,
the facets lie in the
same plane. In that case, we dan join both facets
//if(Plane(f1->halfedge()->vertex()->point(),f1->halfedge()->next()->vertex()->point(),f1->halfedge()->prev()->vertex()->point())==Plane(f2->halfedge()->vertex()->point(),f2->halfedge()->next()->vertex()->point(),f2->halfedge()->prev()->vertex()->point()))
if(f1->plane()==f2->plane())
{
//to join them, I have to find the halfedge that
separates the two faces.
if(f2->halfedge()->opposite()->facet()==f1)
{
p->join_facet(f2->halfedge());
a=true;
}
else
if(f2->halfedge()->next()->opposite()->facet()==f1)
{
p->join_facet(f1->halfedge()->next());
a=true;
}
else
if(f2->halfedge()->prev()->opposite()->facet()==f1)
{
p->join_facet(f2->halfedge()->prev());
a=true;
}
}
if(a)
{
f2=p->facets_begin();
f1=p->facets_begin();
}
else
f2++;
}
f1++;
f2=p->facets_begin();
}
}

--
Dr. J.K. Becker
University of Tuebingen - Institute for Geoscience
Sigwartst. 10 - 72076 Tuebingen (Germany)
Tel.: ++49 7071 29 73139 Fax: +49 7071 5059
web: http://www.jkbecker.de

--
Dr. J.K. Becker
University of Tuebingen - Institute for Geoscience
Sigwartst. 10 - 72076 Tuebingen (Germany)
Tel.: ++49 7071 29 73139 Fax: +49 7071 5059
web: http://www.jkbecker.de


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss







Archive powered by MHonArc 2.6.16.

Top of Page