CGAL 4.11.1 : Create convex hull - compilation errors

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

CGAL 4.11.1 : Create convex hull - compilation errors

Riedel, Torge

Hi,

 

I tried to compute a convex hull of a mesh, but I get compilation errors and do not know how to fix. Here is my code:

 

   typedef CGAL::Simple_cartesian<double> K;

  typedef CGAL::Surface_mesh<K::Point_3> Mesh;

 

   std::vector< CGAL::cpp11::array<double, 3> > points;

   std::vector< CGAL::cpp11::array<int, 3> > triangles;

   CGAL::read_STL(input, points, triangles);

 

   CGAL::Polygon_mesh_processing::orient_polygon_soup(points, triangles);

 

   Mesh m;

   CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, triangles, m);

 

   Mesh sm_convex;

   CGAL::convex_hull_3(m.vertices_begin(), m.vertices_end(), sm_convex);

 

   std::cout << " i Points: " << sm_convex.number_of_vertices() << " Triangles: " << sm_convex.number_of_faces() << std::endl;

 

I get the following compilation errors:

 

1>C:\Evaluation\MeshFW\cgal.org\CGAL-4.11.1\include\CGAL/convex_hull_3.h(903): error C2976: 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3': too few template arguments

1>  C:\Evaluation\MeshFW\cgal.org\CGAL-4.11.1\include\CGAL/convex_hull_3.h(72): note: see declaration of 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3'

1>  main.cpp(114): note: see reference to function template instantiation 'void CGAL::convex_hull_3<CGAL::Surface_mesh<CGAL::Point_3<Kernel_>>::Index_iterator<CGAL::Surface_mesh<CGAL::Point_3<Kernel_>>::Vertex_index>,Mesh>(InputIterator,InputIterator,Polyhedron_3 &)' being compiled

1>          with

1>          [

1>              Kernel_=CGAL::Epick,

1>              InputIterator=CGAL::Surface_mesh<CGAL::Point_3<CGAL::Epick>>::Index_iterator<CGAL::Surface_mesh<CGAL::Point_3<CGAL::Epick>>::Vertex_index>,

1>              Polyhedron_3=Mesh

1>          ]

1>  C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(54): note: see reference to class template instantiation 'boost::arg<9>' being compiled

1>  C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(53): note: see reference to class template instantiation 'boost::arg<8>' being compiled

1>  C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(52): note: see reference to class template instantiation 'boost::arg<7>' being compiled

1>  C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(51): note: see reference to class template instantiation 'boost::arg<6>' being compiled

1>  C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(50): note: see reference to class template instantiation 'boost::arg<5>' being compiled

1>  C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(49): note: see reference to class template instantiation 'boost::arg<4>' being compiled

1>  C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(48): note: see reference to class template instantiation 'boost::arg<3>' being compiled

1>  C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(47): note: see reference to class template instantiation 'boost::arg<2>' being compiled

1>  C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(46): note: see reference to class template instantiation 'boost::arg<1>' being compiled

1>C:\ Evaluation\MeshFW\cgal.org\CGAL-4.11.1\include\CGAL/convex_hull_3.h(903): error C2955: 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3': use of class template requires template argument list

1>  C:\Evaluation\MeshFW\cgal.org\CGAL-4.11.1\include\CGAL/convex_hull_3.h(72): note: see declaration of 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3'

 

In my understanding this is because I passed the vertex iterators to the convex hull function. If I pass iterators of an std::vector of points like the example in the cgal docs does it, it compiles without problems. I was not able to find a way to get iterators to the points of a surface mesh. My challenge is, that the mesh “m” has to be the input source for the complex hull operation. A separate list/vector of the points is not available. So my question is: How to do this? Hopefully without the need to build an extra list of points.

 

Kind regards

Torge


CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, Fax: +49 711 7825-4000, Internet: www.cenit.com
Geschaeftsstellen: Berlin, Frankfurt, Hamburg, Hannover, Muenchen, Oelsnitz, Ratingen, Saarbruecken
Vorstandsmitglieder: Kurt Bengel, Matthias Schmidt
Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), Hubert Leypoldt, Andreas Karrer
Bankverbindungen:
Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 00 SWIFT-CODE : DEUTDESS,
Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 0155 00 SWIFT-Code : COBADEFF600,
Registergericht: Amtsgericht Stuttgart
Handelsregister: HRB Nr. 19117
Umsatzsteuer: ID-Nr. DE 147 862 777
Reply | Threaded
Open this post in threaded view
|

Re: CGAL 4.11.1 : Create convex hull - compilation errors

Sebastien Loriot (GeometryFactory)
The following is working for me:

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <boost/iterator/transform_iterator.hpp>
#include <CGAL/convex_hull_3.h>

typedef CGAL::Simple_cartesian<double> K;
typedef CGAL::Surface_mesh<K::Point_3> Mesh;
typedef Mesh::Property_map<Mesh::Vertex_index, K::Point_3> Vpm;

int main()
{
   Mesh m1, m2;
   CGAL::convex_hull_3(
     boost::make_transform_iterator(m1.vertices().begin(),
 
CGAL::Property_map_to_unary_function<Vpm>(m1.points())),
     boost::make_transform_iterator(m1.vertices().end(),
 
CGAL::Property_map_to_unary_function<Vpm>(m1.points())),
     m2);
}

Side note: you should use exact predicates with the convex hull
algorithm.

Sebastien.

On 03/05/2018 11:05 AM, Riedel, Torge wrote:

> Hi,
>
> I tried to compute a convex hull of a mesh, but I get compilation errors
> and do not know how to fix. Here is my code:
>
>     typedefCGAL::Simple_cartesian<double> K;
>
>    typedefCGAL::Surface_mesh<K::Point_3> Mesh;
>
>     std::vector< CGAL::cpp11::array<double, 3> > points;
>
>     std::vector< CGAL::cpp11::array<int, 3> > triangles;
>
>     CGAL::read_STL(input, points, triangles);
>
>     CGAL::Polygon_mesh_processing::orient_polygon_soup(points, triangles);
>
> Meshm;
>
>     CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points,
> triangles, m);
>
> Meshsm_convex;
>
>     CGAL::convex_hull_3(m.vertices_begin(), m.vertices_end(), sm_convex);
>
>     std::cout <<" i Points: "<<sm_convex.number_of_vertices() <<"
> Triangles: "<<sm_convex.number_of_faces() <<std::endl;
>
> I get the following compilation errors:
>
> 1>C:\Evaluation\MeshFW\cgal.org\CGAL-4.11.1\include\CGAL/convex_hull_3.h(903):
> error C2976:
> 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3': too few
> template arguments
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\CGAL-4.11.1\include\CGAL/convex_hull_3.h(72):
> note: see declaration of
> 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3'
>
> 1>  main.cpp(114): note: see reference to function template
> instantiation 'void
> CGAL::convex_hull_3<CGAL::Surface_mesh<CGAL::Point_3<Kernel_>>::Index_iterator<CGAL::Surface_mesh<CGAL::Point_3<Kernel_>>::Vertex_index>,Mesh>(InputIterator,InputIterator,Polyhedron_3
> &)' being compiled
>
> 1>          with
>
> 1>          [
>
> 1>              Kernel_=CGAL::Epick,
>
> 1>              
> InputIterator=CGAL::Surface_mesh<CGAL::Point_3<CGAL::Epick>>::Index_iterator<CGAL::Surface_mesh<CGAL::Point_3<CGAL::Epick>>::Vertex_index>,
>
> 1>              Polyhedron_3=Mesh
>
> 1>          ]
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(54):
> note: see reference to class template instantiation 'boost::arg<9>'
> being compiled
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(53):
> note: see reference to class template instantiation 'boost::arg<8>'
> being compiled
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(52):
> note: see reference to class template instantiation 'boost::arg<7>'
> being compiled
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(51):
> note: see reference to class template instantiation 'boost::arg<6>'
> being compiled
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(50):
> note: see reference to class template instantiation 'boost::arg<5>'
> being compiled
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(49):
> note: see reference to class template instantiation 'boost::arg<4>'
> being compiled
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(48):
> note: see reference to class template instantiation 'boost::arg<3>'
> being compiled
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(47):
> note: see reference to class template instantiation 'boost::arg<2>'
> being compiled
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hpp(46):
> note: see reference to class template instantiation 'boost::arg<1>'
> being compiled
>
> 1>C:\
> Evaluation\MeshFW\cgal.org\CGAL-4.11.1\include\CGAL/convex_hull_3.h(903): error
> C2955: 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3': use
> of class template requires template argument list
>
> 1>  
> C:\Evaluation\MeshFW\cgal.org\CGAL-4.11.1\include\CGAL/convex_hull_3.h(72):
> note: see declaration of
> 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3'
>
> In my understanding this is because I passed the vertex iterators to the
> convex hull function. If I pass iterators of an std::vector of points
> like the example in the cgal docs does it, it compiles without problems.
> I was not able to find a way to get iterators to the points of a surface
> mesh. My challenge is, that the mesh “m” has to be the input source for
> the complex hull operation. A separate list/vector of the points is not
> available. So my question is: How to do this? Hopefully without the need
> to build an extra list of points.
>
> Kind regards
>
> Torge
>
>
> CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711
> 7825-30, Fax: +49 711 7825-4000, Internet: www.cenit.com
> Geschaeftsstellen: Berlin, Frankfurt, Hamburg, Hannover, Muenchen,
> Oelsnitz, Ratingen, Saarbruecken
> Vorstandsmitglieder: Kurt Bengel, Matthias Schmidt
> Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des
> Aufsichtsrats), Hubert Leypoldt, Andreas Karrer
> Bankverbindungen:
> Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166
> 1040 00 SWIFT-CODE : DEUTDESS,
> Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532
> 0155 00 SWIFT-Code : COBADEFF600,
> Registergericht: Amtsgericht Stuttgart
> Handelsregister: HRB Nr. 19117
> Umsatzsteuer: ID-Nr. DE 147 862 777

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


Reply | Threaded
Open this post in threaded view
|

AW: [cgal-discuss] CGAL 4.11.1 : Create convex hull - compilation errors

Riedel, Torge
Hi,

thank you, that did the trick.

Kind regards
Torge

> -----Ursprüngliche Nachricht-----
> Von: [hidden email] [mailto:[hidden email]] Im
> Auftrag von Sebastien Loriot (GeometryFactory)
> Gesendet: Montag, 5. März 2018 11:24
> An: [hidden email]
> Betreff: Re: [cgal-discuss] CGAL 4.11.1 : Create convex hull - compilation
> errors
>
> The following is working for me:
>
> #include <CGAL/Simple_cartesian.h>
> #include <CGAL/Surface_mesh.h>
> #include <boost/iterator/transform_iterator.hpp>
> #include <CGAL/convex_hull_3.h>
>
> typedef CGAL::Simple_cartesian<double> K; typedef
> CGAL::Surface_mesh<K::Point_3> Mesh; typedef
> Mesh::Property_map<Mesh::Vertex_index, K::Point_3> Vpm;
>
> int main()
> {
>    Mesh m1, m2;
>    CGAL::convex_hull_3(
>      boost::make_transform_iterator(m1.vertices().begin(),
>
> CGAL::Property_map_to_unary_function<Vpm>(m1.points())),
>      boost::make_transform_iterator(m1.vertices().end(),
>
> CGAL::Property_map_to_unary_function<Vpm>(m1.points())),
>      m2);
> }
>
> Side note: you should use exact predicates with the convex hull algorithm.
>
> Sebastien.
>
> On 03/05/2018 11:05 AM, Riedel, Torge wrote:
> > Hi,
> >
> > I tried to compute a convex hull of a mesh, but I get compilation
> > errors and do not know how to fix. Here is my code:
> >
> >     typedefCGAL::Simple_cartesian<double> K;
> >
> >    typedefCGAL::Surface_mesh<K::Point_3> Mesh;
> >
> >     std::vector< CGAL::cpp11::array<double, 3> > points;
> >
> >     std::vector< CGAL::cpp11::array<int, 3> > triangles;
> >
> >     CGAL::read_STL(input, points, triangles);
> >
> >     CGAL::Polygon_mesh_processing::orient_polygon_soup(points,
> > triangles);
> >
> > Meshm;
> >
> >
> >
> CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points,
> > triangles, m);
> >
> > Meshsm_convex;
> >
> >     CGAL::convex_hull_3(m.vertices_begin(), m.vertices_end(),
> > sm_convex);
> >
> >     std::cout <<" i Points: "<<sm_convex.number_of_vertices() <<"
> > Triangles: "<<sm_convex.number_of_faces() <<std::endl;
> >
> > I get the following compilation errors:
> >
> > 1>C:\Evaluation\MeshFW\cgal.org\CGAL-
> 4.11.1\include\CGAL/convex_hull_3.h(903):
> > error C2976:
> > 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3': too few
> > template arguments
> >
> > 1>
> > C:\Evaluation\MeshFW\cgal.org\CGAL-
> 4.11.1\include\CGAL/convex_hull_3.h(72):
> > note: see declaration of
> > 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3'
> >
> > 1>  main.cpp(114): note: see reference to function template
> > instantiation 'void
> >
> CGAL::convex_hull_3<CGAL::Surface_mesh<CGAL::Point_3<Kernel_>>::Ind
> ex_
> >
> iterator<CGAL::Surface_mesh<CGAL::Point_3<Kernel_>>::Vertex_index>,M
> es
> > h>(InputIterator,InputIterator,Polyhedron_3
> > &)' being compiled
> >
> > 1>          with
> >
> > 1>          [
> >
> > 1>              Kernel_=CGAL::Epick,
> >
> > 1>
> >
> InputIterator=CGAL::Surface_mesh<CGAL::Point_3<CGAL::Epick>>::Index_it
> >
> erator<CGAL::Surface_mesh<CGAL::Point_3<CGAL::Epick>>::Vertex_index>
> ,
> >
> > 1>              Polyhedron_3=Mesh
> >
> > 1>          ]
> >
> > 1>
> >
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hp
> p(54):
> > note: see reference to class template instantiation 'boost::arg<9>'
> > being compiled
> >
> > 1>
> >
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hp
> p(53):
> > note: see reference to class template instantiation 'boost::arg<8>'
> > being compiled
> >
> > 1>
> >
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hp
> p(52):
> > note: see reference to class template instantiation 'boost::arg<7>'
> > being compiled
> >
> > 1>
> >
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hp
> p(51):
> > note: see reference to class template instantiation 'boost::arg<6>'
> > being compiled
> >
> > 1>
> >
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hp
> p(50):
> > note: see reference to class template instantiation 'boost::arg<5>'
> > being compiled
> >
> > 1>
> >
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hp
> p(49):
> > note: see reference to class template instantiation 'boost::arg<4>'
> > being compiled
> >
> > 1>
> >
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hp
> p(48):
> > note: see reference to class template instantiation 'boost::arg<3>'
> > being compiled
> >
> > 1>
> >
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hp
> p(47):
> > note: see reference to class template instantiation 'boost::arg<2>'
> > being compiled
> >
> > 1>
> >
> C:\Evaluation\MeshFW\cgal.org\boost_1_66_0\boost/bind/placeholders.hp
> p(46):
> > note: see reference to class template instantiation 'boost::arg<1>'
> > being compiled
> >
> > 1>C:\
> > Evaluation\MeshFW\cgal.org\CGAL-
> 4.11.1\include\CGAL/convex_hull_3.h(90
> > 3): error
> > C2955: 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3':
> > use of class template requires template argument list
> >
> > 1>
> > C:\Evaluation\MeshFW\cgal.org\CGAL-
> 4.11.1\include\CGAL/convex_hull_3.h(72):
> > note: see declaration of
> > 'CGAL::internal::Convex_hull_3::Default_traits_for_Chull_3'
> >
> > In my understanding this is because I passed the vertex iterators to
> > the convex hull function. If I pass iterators of an std::vector of
> > points like the example in the cgal docs does it, it compiles without
> problems.
> > I was not able to find a way to get iterators to the points of a
> > surface mesh. My challenge is, that the mesh "m" has to be the input
> > source for the complex hull operation. A separate list/vector of the
> > points is not available. So my question is: How to do this? Hopefully
> > without the need to build an extra list of points.
> >
> > Kind regards
> >
> > Torge
> >
> >
> > CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711
> > 7825-30, Fax: +49 711 7825-4000, Internet: www.cenit.com
> > Geschaeftsstellen: Berlin, Frankfurt, Hamburg, Hannover, Muenchen,
> > Oelsnitz, Ratingen, Saarbruecken
> > Vorstandsmitglieder: Kurt Bengel, Matthias Schmidt
> > Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des
> > Aufsichtsrats), Hubert Leypoldt, Andreas Karrer
> > Bankverbindungen:
> > Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070
> > 0166
> > 1040 00 SWIFT-CODE : DEUTDESS,
> > Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071
> > 0532
> > 0155 00 SWIFT-Code : COBADEFF600,
> > Registergericht: Amtsgericht Stuttgart
> > Handelsregister: HRB Nr. 19117
> > Umsatzsteuer: ID-Nr. DE 147 862 777
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://sympa.inria.fr/sympa/info/cgal-discuss
>


CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, Fax: +49 711 7825-4000, Internet: www.cenit.com
Geschaeftsstellen: Berlin, Frankfurt, Hamburg, Hannover, Muenchen, Oelsnitz, Ratingen, Saarbruecken
Vorstandsmitglieder: Kurt Bengel, Matthias Schmidt
Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), Hubert Leypoldt, Andreas Karrer
Bankverbindungen:
Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 00 SWIFT-CODE : DEUTDESS,
Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 0155 00 SWIFT-Code : COBADEFF600,
Registergericht: Amtsgericht Stuttgart
Handelsregister: HRB Nr. 19117
Umsatzsteuer: ID-Nr. DE 147 862 777


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