CGAL error: calculating half-space intersection without given point cannot be compiled (boost :: none?)

I created Boost 1.58.0 and CGAL 4.6 and linked them well in a project with sample code here . This compiles and works fine:

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Convex_hull_3/dual/halfspace_intersection_3.h>
#include <CGAL/point_generators_3.h>
#include <list>
typedef CGAL::Exact_predicates_inexact_constructions_kernel   K;
typedef K::Plane_3                                            Plane;
typedef K::Point_3                                            Point;
typedef CGAL::Polyhedron_3<K>                                 Polyhedron_3;
// compute the tangent plane of a point
template <typename K>
typename K::Plane_3 tangent_plane (typename K::Point_3 const& p) {
    typename K::Vector_3 v(p.x(), p.y(), p.z());
    v = v / sqrt(v.squared_length());
    typename K::Plane_3 plane(v.x(), v.y(), v.z(), -(p - CGAL::ORIGIN) * v);
    return plane;
}
int main (void) {
    // number of generated planes
    int N = 200;
    // generates random planes on a sphere
    std::list<Plane> planes;
    CGAL::Random_points_on_sphere_3<Point> g;
    for (int i = 0; i < N; i++) {
        planes.push_back(tangent_plane<K>(*g++));
    }
    // define polyhedron to hold the intersection
    Polyhedron_3 P;
    // compute the intersection
    // if a point inside the intersection is unknown, pass boost::none
    // to automatically found one using linear programming
    CGAL::halfspace_intersection_3(planes.begin(),
                                   planes.end(),
                                   P,
                                   Point(0, 0, 0)); // PROBLEMATIC WHEN REMOVED
    return 0;
}

      

However, by removing the last argument, or "correctly" (that is, according to the specs here ) by setting it to boost::none

, the following compilation error:

||=== CGALtest, Debug ===|
e:\Users\Bombax\Cpp\Libraries\CGAL-4.6\include\CGAL\Convex_hull_3\dual\halfspace_intersection_3.h||In function 'void CGAL::halfspace_intersection_3(PlaneIterator, PlaneIterator, Polyhedron&) [with PlaneIterator = std::_List_iterator<CGAL::Plane_3<CGAL::Epick> >, Polyhedron = Polyhedron_3]':|
e:\Users\Bombax\Cpp\Tests\CGALtest\example.cpp|33|instantiated from here|
e:\Users\Bombax\Cpp\Libraries\CGAL-4.6\include\CGAL\Convex_hull_3\dual\halfspace_intersection_3.h|318|error: invalid initialization of reference of type 'const CGAL::Point_3<CGAL::Epick>&' from expression of type 'const boost::none_t'|
e:\Users\Bombax\Cpp\Libraries\CGAL-4.6\include\CGAL\Convex_hull_3\dual\halfspace_intersection_3.h|323|error: in passing argument 4 of 'void CGAL::halfspace_intersection_3(PlaneIterator, PlaneIterator, Polyhedron&, const typename Polyhedron::Vertex::Point_3&) [with PlaneIterator = std::_List_iterator<CGAL::Plane_3<CGAL::Epick> >, Polyhedron = CGAL::Polyhedron_3<CGAL::Epick, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::allocator<int> >]'|
e:\Users\Bombax\Cpp\Libraries\boost_1_58_0\boost\system\error_code.hpp|221|warning: 'boost::system::posix_category' defined but not used|
e:\Users\Bombax\Cpp\Libraries\boost_1_58_0\boost\system\error_code.hpp|222|warning: 'boost::system::errno_ecat' defined but not used|
e:\Users\Bombax\Cpp\Libraries\boost_1_58_0\boost\system\error_code.hpp|223|warning: 'boost::system::native_ecat' defined but not used|
||=== Build finished: 2 errors, 3 warnings ===|

      

What's going on here? Has Boost changed something that makes it unusable boost::none

?

Thank you for your help.

+3


source to share


2 answers


I actually managed to get it working with the following workaround:

CGAL::halfspace_intersection_3(planes.begin(),
                                   planes.end(),
                                   poly,
                                   static_cast<boost::optional<Point> >(boost::none));

      



Thanks for relaying the bug though!

0


source


There is indeed a bug in CGAL. I passed the question to the CGAL developers in charge of this part of CGAL. If they don't answer directly on StackOverflow, I'll edit this answer to offer you a patch.

Edit: Reported on Github: https://github.com/CGAL/cgal/issues/75



(I'll post an answer / patch here if there is one.)

+2


source







All Articles