Add a test

This commit is contained in:
Maxime Gimeno 2020-01-31 16:00:42 +01:00
parent a3e60c8475
commit fa14310c41
2 changed files with 38 additions and 2 deletions

View File

@ -37,6 +37,7 @@
#include <memory>
#include <list>
#include <vector>
#include <type_traits>
#include <boost/bind.hpp>
#include <boost/next_prior.hpp>
#include <boost/type_traits/is_floating_point.hpp>
@ -51,6 +52,7 @@
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/boost/iterator/transform_iterator.hpp>
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/is_iterator.h>
#include <boost/unordered_map.hpp>
@ -1038,7 +1040,10 @@ void convex_hull_3(InputIterator first, InputIterator beyond,
template <class InputIterator, class Polyhedron_3>
void convex_hull_3(InputIterator first, InputIterator beyond,
Polyhedron_3& polyhedron)
Polyhedron_3& polyhedron,
typename std::enable_if<
CGAL::is_iterator<InputIterator>::value
>::type* =0) //workaround to avoid ambiguity with next overload.
{
typedef typename std::iterator_traits<InputIterator>::value_type Point_3;
typedef typename internal::Convex_hull_3::Default_traits_for_Chull_3<Point_3, Polyhedron_3>::type Traits;
@ -1056,7 +1061,6 @@ void convex_hull_3(const VertexListGraph& g,
Vpmap vpm = CGAL::parameters::choose_parameter(CGAL::parameters::get_parameter(np, internal_np::vertex_point),
get_const_property_map(boost::vertex_point, g));
Vpmap_fct v2p(vpm);
convex_hull_3(
boost::make_transform_iterator(vertices(g).begin(), v2p),

View File

@ -0,0 +1,32 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/convex_hull_3.h>
#include <vector>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedron_3<K> Polyhedron_3;
typedef K::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
int main(int argc, char* argv[])
{
std::ifstream in( (argc>1)? argv[1] : "data/cross.off");
Surface_mesh poly;
if(!(in >> poly))
{
std::cerr<<"Could not find input file."<<std::endl;
return 1;
}
Surface_mesh chull;
// compute convex hull
auto np = CGAL::parameters::all_default();
CGAL::convex_hull_3(poly, chull, np);
std::cout << "The convex hull contains " << chull.number_of_vertices() << " vertices" << std::endl;
return 0;
}