0

I'm currently trying to use the SDF algorithm of CGAL but I have some boost errors and I don't know where it's from. I followed the example code from CGAL doc

Here's the part of my code :

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/mesh_segmentation.h>
#include <CGAL/property_map.h>

[...]

    void ShapeDiameterFunction_Component::SDF_Algorithm(PolyhedronPtr pMesh)
    {
        pMesh->triangulate();

        srand((unsigned)time(NULL));

        // create a property-map for segment-ids
        typedef std::map<Polyhedron::Facet_const_handle, std::size_t> Facet_int_map;
        Facet_int_map internal_segment_map;
        boost::associative_property_map<Facet_int_map> segment_property_map(internal_segment_map);

        // calculate SDF values and segment the mesh using default parameters.
        std::size_t number_of_segments = CGAL::segmentation_via_sdf_values(pMesh, segment_property_map);
        std::cout << "Number of segments: " << number_of_segments << std::endl;
    }

I'm getting an error when I use the "segmentation_via_sdf_values" function :

/usr/include/boost/mpl/eval_if.hpp|38|error: no type named ‘type’ in ‘boost::mpl::eval_if<boost::detail::has_vertex_property_type<boost::shared_ptr<Enriched_polyhedron<CGAL::Simple_cartesian<double>, Enriched_items> >, mpl_::bool_<false> >, boost::detail::get_vertex_property_type<boost::shared_ptr<Enriched_polyhedron<CGAL::Simple_cartesian<double>, Enriched_items> > >, boost::no_property>::f_ {aka struct boost::no_property}’|

I don't know if it's from my boost installation or from the code itself. I'm using the 1.55 version of libboost-dev and the 4.5.2 version for CGAL. I'm using Ubuntu 15.04 version and my compiler is the GCC compiler 4.9.2.

I tried the example from CGAL documentation is another project and it did compile.

[EDIT] Here is my compiler log.

Thanks, CornFlex

CornFlex
  • 1
  • 3
  • Did you modify the example? If yes please post the complete example you're trying to compile. – sloriot Jun 02 '15 at 14:33
  • I created a new project with only the example code and the CGAL library and it works fine. I'm using this code with the [MEPP](https://liris.cnrs.fr/mepp/) project and it doesn't work. Can't post full code because it's pretty large. – CornFlex Jun 03 '15 at 07:55
  • @CornFlex Pleas edit your question so that you can tell which versions of CGAL and Boost you are using, as well as the operating system and compiler (names and versions as well). That might be important. – lrineau Jun 03 '15 at 09:02
  • Post edited with compiler/OS/CGAL versions – CornFlex Jun 03 '15 at 09:27
  • Thanks @CornFlex. As we cannot reproduce your error (because you cannot provide the code), we have to remotely debug the issue, asking questions. I do not see anything unusual (or non-tested) in your compiler version or version of CGAL and Boost. 1/ I suggest you try with CGAL-4.6. 2/ Can you copy-paste, to http://gist.github.com/ for example, the full error log (usually the error goes on with lines saying "...detected during:" or explaining the chain of instantiations. And then edit your question to add the link to the full log. That might help. – lrineau Jun 03 '15 at 12:52
  • I tried with the CGAL 4.6.2 version but still the same error. I edited my post with the full error log. – CornFlex Jun 03 '15 at 14:57
  • @CornFlex: Could you at least post the Polyhedron type you're using as well as the property maps passed to the sdf functions? – sloriot Jun 04 '15 at 07:15
  • @sloriot is right. You do not give us enough information. Your compiler log shows that you are using a class template `Enriched_polyhedron` that is not part of CGAL documented classes. What is its definition? That is very important for the understanding of the error you report. – lrineau Jun 11 '15 at 16:20

1 Answers1

0

I found my problem, I use the MEPP library which uses the CGAL library. The MEPP library is redefining the typedef declaration of "Polyhedron" and the "pMesh" sent to the sdf_values function isn't the same type as the "Polyhedron" wanted. Of course, the type is checked with boost (eval_if) and that's why it gives me this error.

 typedef CGAL::Exact_predicates_inexact_constructions_kernel KernelSDF;
 typedef CGAL::Polyhedron_3<KernelSDF> PolyhedronSDF;

 PolyhedronSDF mesh;

 typedef std::map< PolyhedronSDF::Facet_const_handle, double> Facet_double_map;
 Facet_double_map internal_map;
 boost::associative_property_map<Facet_double_map> sdf_property_map(internal_map);
 // compute SDF values
 std::pair<double, double> min_max_sdf = CGAL::sdf_values(mesh, sdf_property_map);

Now I just have to copy my pMesh into my mesh object !

Thanks.

CornFlex
  • 1
  • 3
  • Note that the sdf functions are working with any polyhedron type, only the property map should be adapted to the polyhedron type. – sloriot Jun 15 '15 at 07:46