diff --git a/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp new file mode 100644 index 00000000000..8d80ab79138 --- /dev/null +++ b/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp @@ -0,0 +1,49 @@ +#include +#include +#include +#include +#include +#include + +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef K::Point_3 Point_3; +typedef CGAL::Delaunay_triangulation_3 Delaunay; +typedef Delaunay::Vertex_handle Vertex_handle; +typedef CGAL::Surface_mesh Surface_mesh; + +int main() +{ + CGAL::Random_points_in_sphere_3 gen(100.0); + std::list points; + + // generate 250 points randomly in a sphere of radius 100.0 + // and insert them into the triangulation + CGAL::cpp11::copy_n(gen, 250, std::back_inserter(points) ); + Delaunay T; + T.insert(points.begin(), points.end()); + + std::list vertices; + T.incident_vertices(T.infinite_vertex(), std::back_inserter(vertices)); + std::cout << "This convex hull of the 250 points has " + << vertices.size() << " points on it." << std::endl; + + // remove 25 of the input points + std::list::iterator v_set_it = vertices.begin(); + for (int i = 0; i < 25; i++) + { + T.remove(*v_set_it); + v_set_it++; + } + + //copy the convex hull of points into a polyhedron and use it + //to get the number of points on the convex hull + Surface_mesh chull; + CGAL::convex_hull_3_to_face_graph(T, chull); + + std::cout << "After removal of 25 points, there are " + << num_vertices(chull) << " points on the convex hull." << std::endl; + + return 0; +} diff --git a/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_SM_3.cpp b/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_SM_3.cpp index 8d80ab79138..a8a8e82eb31 100644 --- a/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_SM_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_SM_3.cpp @@ -3,7 +3,8 @@ #include #include #include -#include +#include +#include #include @@ -11,7 +12,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_3 Point_3; typedef CGAL::Delaunay_triangulation_3 Delaunay; typedef Delaunay::Vertex_handle Vertex_handle; -typedef CGAL::Surface_mesh Surface_mesh; +typedef CGAL::Surface_mesh Polyhedron_3; int main() { @@ -39,8 +40,8 @@ int main() //copy the convex hull of points into a polyhedron and use it //to get the number of points on the convex hull - Surface_mesh chull; - CGAL::convex_hull_3_to_face_graph(T, chull); + Polyhedron_3 chull; + CGAL::link_to_face_graph(T, T.infinite_vertex(), chull); std::cout << "After removal of 25 points, there are " << num_vertices(chull) << " points on the convex hull." << std::endl;