diff --git a/Convex_hull_3/examples/Convex_hull_3/quickhull_indexed_triangle_set_3.cpp b/Convex_hull_3/examples/Convex_hull_3/quickhull_indexed_triangle_set_3.cpp index 676adc30c29..1d524c31ebb 100644 --- a/Convex_hull_3/examples/Convex_hull_3/quickhull_indexed_triangle_set_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/quickhull_indexed_triangle_set_3.cpp @@ -3,28 +3,31 @@ #include #include +#include #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_3 Point_3; -typedef CGAL::Indexed_triangle_set Surface_mesh; int main(int argc, char* argv[]) { std::ifstream in( (argc>1)? argv[1] : "data/cube.xyz"); std::vector points; + + std::vector vertices; + std::vector > faces; + Point_3 p; while(in >> p){ points.push_back(p); } - Surface_mesh sm; - CGAL::convex_hull_3(points.begin(), points.end(), sm); + + CGAL::convex_hull_3(points.begin(), points.end(), vertices, faces); - std::cout << sm << std::endl; - //std::cout << "The convex hull contains " << num_vertices(sm) << " vertices" << std::endl; + std::cout << vertices.size() << " " << faces.size() << std::endl; return 0; } diff --git a/Convex_hull_3/include/CGAL/Indexed_triangle_set.h b/Convex_hull_3/include/CGAL/Indexed_triangle_set.h index 371aa9337a9..9d76cdf68d1 100644 --- a/Convex_hull_3/include/CGAL/Indexed_triangle_set.h +++ b/Convex_hull_3/include/CGAL/Indexed_triangle_set.h @@ -27,8 +27,13 @@ namespace CGAL { template struct Indexed_triangle_set { - std::vector

vertices; - std::vector > faces; + std::vector

& vertices; + std::vector >& faces; + + Indexed_triangle_set(std::vector

& vertices, + std::vector >& faces) + : vertices(vertices), faces(faces) + {} }; diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index e6ff827f2cb..4076e75a815 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -1085,6 +1085,19 @@ void convex_hull_3(const VertexListGraph& g, convex_hull_3(g,pm,CGAL::parameters::all_default()); } +template +void convex_hull_3(InputIterator first, InputIterator beyond, + std::vector

& vertices, + std::vector >& faces, + typename std::enable_if::value>::type* = 0) +{ + typedef typename std::iterator_traits::value_type Point_3; + typedef typename Kernel_traits::type Traits; + + Indexed_triangle_set its(vertices,faces); + convex_hull_3(first, beyond, its, Traits()); +} + template OutputIterator extreme_points_3(const InputRange& range,