Subject: CGAL users discussion list
List archive
- From: AP <>
- To:
- Subject: [cgal-discuss] Exploration of facets in a convex hull of points
- Date: Tue, 21 Feb 2012 10:20:37 -0800 (PST)
Dear all,
I am currently implementing an algorithm that require an incremental
computation of convex hull of points, and I need to know the normal to the
facets of these convex hulls.
The computation is done and updated without any problem following the demo
example "incremental_hull_3_demo.cpp", but I have some strange problems in
the exploration of the facets.
Here is an example below.
int main()
{
Convex_hull_3 CH(3); // create instance of the class with dimension == 3
/* Insertion of points in the convex hull
... */
facet f,g; /* f and g should be used as iterator to explore the facets
*/
f = CH.facets_begin(); /* f should point on the first facet */
g = f; /* g point also on the first facet */
pl = CH.hyperplane_supporting(f);
std::cout << pl.a() << "," << pl.b() << "," << pl.c() << "," <<
std::endl; /* We print the normal to the first facet */
f++; /* f is incremented and point on the second facet */
pl = CH.hyperplane_supporting(f);
std::cout << pl.a() << "," << pl.b() << "," << pl.c() << "," <<
std::endl; /* We print the normal to the second facet */
pl = CH.hyperplane_supporting(g); /* g should be unchanged and should
point on the first facet... */
std::cout << pl.a() << "," << pl.b() << "," << pl.c() << "," <<
std::endl; /* And we should print the normal of the first facet, however...
*/
exit(0);
/* ... */
}
However, the printing on the screen is :
900060001,900060001,900060001,
-898079935,-960032,-960032,
-898079935,-960032,-960032,
I.e. when we increment f, g is also incremented!!!
This makes impossible to use a facet as "current" and the other as "next"
the same way as we would with linked list in the language C. I have tried
some tricks without beeing succesful. I have used a void * to store the
adress pointed by g but it was refused by the compiler, and I have tried to
use a const facet for g but its value was also changed!
Thanks in advance for the help!
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Exploration-of-facets-in-a-convex-hull-of-points-tp4407829p4407829.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Exploration of facets in a convex hull of points, AP, 02/21/2012
- Re: [cgal-discuss] Exploration of facets in a convex hull of points, Sebastien Loriot (GeometryFactory), 02/22/2012
Archive powered by MHonArc 2.6.16.