diff --git a/Convex_hull_3/doc/Convex_hull_3/Convex_hull_3.txt b/Convex_hull_3/doc/Convex_hull_3/Convex_hull_3.txt index a4bab8227fc..a7e645ac64d 100644 --- a/Convex_hull_3/doc/Convex_hull_3/Convex_hull_3.txt +++ b/Convex_hull_3/doc/Convex_hull_3/Convex_hull_3.txt @@ -55,15 +55,31 @@ the traits `Convex_hull_traits_3` should be used (`R` being the input kernel). Note that the default traits class takes this into account. -\subsection Convex_hull_3ConvexityChecking Convexity Checking +\subsubsection Convex_hull_3Example Example + +The following program reads points from an input file and computes +their convex hull. We assume that the points are +not all identical and not all collinear, thus we directly use a polyhedron +as output. In the example you see that the convex hull function can +write in any model of the concept `MutableFaceListGraph`. + + +\cgalExample{Convex_hull_3/quickhull_3.cpp} + + +\subsubsection Convex_hull_3Example Example for lower dimensional results + +The following program reads points from an input file and computes +their convex hull. Depending on the dimension of the result, we will +get a point, a segment, a triangle, or a polyhedral surface. +Note that the latter may also be planar polygon with a border. + +\cgalExample{Convex_hull_3/quickhull_any_dim_3.cpp} + -The function `is_strongly_convex_3()` -implements the algorithm of Mehlhorn et al. \cgalCite{mnssssu-cgpvg-96} -to determine if the vertices of a given polytope constitute a strongly convex -point set or not. This function is used in postcondition testing for -`convex_hull_3()`. \subsection Convex_hull_3HalfspaceIntersection Halfspace Intersection + The functions `halfspace_intersection_3()` and `halfspace_intersection_with_constructions_3()` uses the convex hull algorithm and the duality to compute the intersection @@ -75,21 +91,22 @@ In order to compute the intersection an interior point is needed. It can be either given by the user or computed using linear programming. Notice that the second approach is slower due to the resolution of a linear program. +\subsubsection Convex_hull_3HalfspaceInntersectionExample Example + The following program computes the intersection of halfspaces defined by tangent planes to a sphere: \cgalExample{Convex_hull_3/halfspace_intersection_3.cpp} -\subsection Convex_hull_3Example Example -The following program computes the convex hull of a set of 250 random -points chosen from a sphere of radius 100. We assume that the points are -not all identical and not all collinear, thus we directly use a polyhedron -as output. Note the usage of the functor `Plane_from_facet` together with -`std::transform()` to compute the equations of the plane of each facet -of the convex hull. +\subsection Convex_hull_3ConvexityChecking Convexity Checking + +The function `is_strongly_convex_3()` +implements the algorithm of Mehlhorn et al. \cgalCite{mnssssu-cgpvg-96} +to determine if the vertices of a given polytope constitute a strongly convex +point set or not. This function is used in postcondition testing for +`convex_hull_3()`. -\cgalExample{Convex_hull_3/quickhull_3.cpp} \section Convex_hull_3Dynamic Dynamic Convex Hull Construction diff --git a/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp index 513e273ca01..2bb1dc02cb9 100644 --- a/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -7,6 +8,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Polyhedron_3 Polyhedron_3; typedef K::Point_3 Point_3; +typedef CGAL::Surface_mesh Surface_mesh; int main(int argc, char* argv[]) @@ -26,5 +28,13 @@ int main(int argc, char* argv[]) std::cout << "The convex hull contains " << poly.size_of_vertices() << " vertices" << std::endl; + Surface_mesh sm; + + CGAL::convex_hull_3(points.begin(), points.end(), sm); + + std::cout << "The convex hull contains " << num_vertices(sm) << " vertices" << std::endl; + + + return 0; }