Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Bug in halfspaces_intersection.h - or - How to efficiently compute intersection of half-planes (continued)

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Bug in halfspaces_intersection.h - or - How to efficiently compute intersection of half-planes (continued)


Chronological Thread 
  • From: Илья Палачев <>
  • To: "" <>, "Laurent Rineau (CGAL/GeometryFactory)" <>, , Quentin Merigot <>,
  • Subject: Re: [cgal-discuss] Bug in halfspaces_intersection.h - or - How to efficiently compute intersection of half-planes (continued)
  • Date: Wed, 05 Nov 2014 21:20:11 +0300
  • Envelope-from:

Hi,
 
I'm using 4.3 version of CGAL. Do you advise to update it?

Ilya uses 'true' for the second parameter:

I did not change anything in Quentin's code except one that line.
 
BTW, I've found another issue related with this function.
After construction of the intersection, the assertion is_strongly_convex_3 fails.
 
Here is my code:
 
static VectorXd buildStartingVector(SupportFunctionDataPtr data)
{
// Some code
 
/* Construct intersection of support halfspaces represented by planes */
std::vector<Plane_3> planes = data->supportPlanes();
Polyhedron_3 intersection;
globalPCLDumper(PCL_DUMPER_LEVEL_DEBUG,
".support-planes-for-halfspaces_intersection.txt")
<< planes;
CGAL::internal::halfspaces_intersection(planes.begin(), planes.end(),
intersection, Kernel());
 
ASSERT(is_strongly_convex_3(intersection));
 
        // Some code
}
 
I have printed planes to file and attached them to this mail. Here is the way they were printed:
 
std::ostream &operator<<(std::ostream &stream, std::vector<Plane_3> planes)
{
for (auto plane = planes.begin(); plane != planes.end(); ++plane)
stream << plane->a() << " " << plane->b() << " " << plane->c()
<< " " << plane->d() << std::endl;
return stream;
}
 
It is interesting that even if I remove check "ASSERT(is_strongly_convex_3(intersection))" and if I get the hull of its points, the assertion also fails:
 
Polyhedron_3 hull;
std::vector<Point_3> points;
for (auto vertex = intersection.vertices_begin();
vertex != intersection.vertices_end(); ++vertex)
{
points.push_back(vertex->point());
}
CGAL::convex_hull_3(points.begin(), points.end(), hull);
ASSERT(is_strongly_convex_3(hull));
 
 
Do you think that upgrade to CGAL 4.5 can resolve this issue?
 
Best regards,
Ilya
 
03.11.2014, 19:14, "Laurent Rineau (CGAL/GeometryFactory)" <>:

Le Monday 03 November 2014 15:23:09 Quentin Merigot a écrit :

 Thank you for this bug report, it is now fixed in my repository. However, I
 must say that I am surprised that it did not work before this change: the
 numbers provided to the constructor of Polyhedron_incremental_builder_3 are
 in principle only used as estimations to reserve memory. What version of
 CGAL are you using ?

The constructor of CGAL::Polyhedron_incremental_builder has a second parameter
that is a Boolean:
http://doc.cgal.org/latest/Polyhedron/classCGAL_1_1Polyhedron__incremental__builder__3.html#acb8216ef40323e777f57cd4656d98c83

When it is set to 'true', then that class template does extra checks, and
display diagnostics.

Ilya uses 'true' for the second parameter:

       typename CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true);

       B.begin_surface(_primal.size_of_facets(),
                       _primal.size_of_vertices(),
                       _primal.size_of_vertices());

That explains the reported behavior.

--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory           http://www.geometryfactory.com/
Release Manager of the CGAL Project       http://www.cgal.org/


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

-0.001 0.999999 -9.99046e-05 1.0016
-1.06546e-07 0.000106546 -1 0.999806
0.000999999 -0.999999 -0.000872141 1.001
2.85825e-07 -0.000285825 1 0.999635
-0.00036923 0.000507134 -1 1.0003
7.25594e-05 -9.96597e-05 -1 1.00014
0.588594 -0.808429 -0.000798501 1.39691
-5.84297e-05 8.02527e-05 1 1.00015
-0.000405167 0.000556494 1 1.00028
-0.588594 0.808429 2.71496e-06 1.39719
-0.951365 0.308066 -0.000789439 1.25942
-0.000584157 0.000189159 -1 1.00018
0.951365 -0.308066 4.58535e-05 1.25912
-0.000162369 5.25774e-05 1 1.00045
-0.000614029 0.000198831 1 1.00014
-5.57541e-05 -1.81773e-05 -1 1.00041
0.950747 0.309968 0.000529069 1.26082
0.000113941 3.71478e-05 1 1.00042
-0.000551538 -0.000179815 1 1.00087
-0.950747 -0.309968 0.000495803 1.26075
-0.000141824 -0.000195615 -1 1.00054
-9.96415e-05 -0.000137434 -1 1.00055
0.586976 0.809604 -0.000563758 1.3963
0.000404045 0.000557291 1 1.00039
-6.68507e-05 -9.22059e-05 1 1.00022
-0.586976 -0.809604 0.000180982 1.39661
0.001 -0.999999 -0.000131061 1.00126
1.16418e-07 -0.000116418 -1 1.00009
-0.001 0.999999 -0.000106381 1.00133
2.61966e-07 -0.000261966 1 1.00009
0.588594 -0.808429 -0.000372366 1.39699
-0.000125594 0.000172502 -1 1.00031
-0.588594 0.808429 -0.000409475 1.39676
-0.000437329 0.000600668 1 1.00024
0.00020112 -0.000276237 1 1.00048
9.74291e-05 -3.1549e-05 -1 1.00077
-0.000225536 7.3032e-05 -1 1.00099
-0.951365 0.308066 -0.000510707 1.25897
-0.00287328 0.000930409 0.999995 1.00289
0.000899437 -0.000291251 1 1.00034
0.951365 -0.308066 0.000224024 1.25926
0.950747 0.309968 -0.000496784 1.26086
0.00146353 0.000477149 -0.999999 1.00111
-0.000357552 -0.000116571 -1 0.99989
-0.950747 -0.309968 -0.000696118 1.26041
-0.000559562 -0.000182432 1 1.00052
0.000327608 0.000106808 1 1.00112
0.586976 0.809604 -0.00036087 1.39629
0.000687274 0.000947944 -0.999999 1.00064
-0.000212731 -0.000293416 -1 1.00098
-0.586976 -0.809604 0.000504835 1.39671
-0.000101611 -0.000140149 1 1.00062
0.00028499 0.000393081 1 1.00047



Archive powered by MHonArc 2.6.18.

Top of Page