|
|
|
|
@ -32,13 +32,13 @@ triangulation to get a fully dynamic computation.
|
|
|
|
|
\section secconvex_hull_3 Static Convex Hull Construction
|
|
|
|
|
|
|
|
|
|
The function
|
|
|
|
|
`convex_hull_3`C provides an
|
|
|
|
|
`::convex_hull_3` provides an
|
|
|
|
|
implementation of the quickhull algorithm \cite bdh-qach-96 for three
|
|
|
|
|
dimensionsquickhull, 3D. There are two versions of this
|
|
|
|
|
function available, one that can be used when it is known that the output
|
|
|
|
|
will be a polyhedron (<I>i.e.</I>, there are more than three points and
|
|
|
|
|
they are not all collinear) and one that handles all degenerate cases
|
|
|
|
|
and returns a `CGAL::Object`, which may be a point, a segment, a
|
|
|
|
|
and returns a `::Object`, which may be a point, a segment, a
|
|
|
|
|
triangle, or a polyhedron. Both versions accept a range of input
|
|
|
|
|
iterators defining the set of points whose convex hull is to be computed
|
|
|
|
|
and a traits class defining the geometric types and predicates used in
|
|
|
|
|
@ -46,7 +46,7 @@ computing the hull.
|
|
|
|
|
|
|
|
|
|
## Traits Class ##
|
|
|
|
|
|
|
|
|
|
The function `convex_hull_3` is parameterized by a traits class,
|
|
|
|
|
The function `::convex_hull_3` is parameterized by a traits class,
|
|
|
|
|
which specifies the types and geometric primitives to be used in the
|
|
|
|
|
computation. If input points from a kernel with exact predicates
|
|
|
|
|
and non-exact constructions are used, and a certified result is expected,
|
|
|
|
|
@ -56,11 +56,11 @@ account.
|
|
|
|
|
|
|
|
|
|
## Convexity Checking ##
|
|
|
|
|
|
|
|
|
|
The function `is_strongly_convex_3`C
|
|
|
|
|
The function `::is_strongly_convex_3`
|
|
|
|
|
implements the algorithm of Mehlhorn <I>et al.</I> \cite 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`.
|
|
|
|
|
`::convex_hull_3`.
|
|
|
|
|
|
|
|
|
|
## Example ##
|
|
|
|
|
|
|
|
|
|
@ -75,15 +75,15 @@ of the convex hull.
|
|
|
|
|
|
|
|
|
|
# Incremental Convex Hull Construction #
|
|
|
|
|
|
|
|
|
|
The function `convex_hull_incremental_3` C provides an
|
|
|
|
|
interface similar to `convex_hull_3` for the \f$ d\f$-dimensional
|
|
|
|
|
The function `::convex_hull_incremental_3` C provides an
|
|
|
|
|
interface similar to `::convex_hull_3` for the \f$ d\f$-dimensional
|
|
|
|
|
incremental construction algorithm \cite cms-frric-93
|
|
|
|
|
implemented by the class `CGAL::Convex_hull_d<R>` that is specialized
|
|
|
|
|
implemented by the class `::Convex_hull_d<R>` that is specialized
|
|
|
|
|
to three dimensions. This function accepts an iterator range over a set of
|
|
|
|
|
input points and returns a polyhedron, but it does not have a traits class
|
|
|
|
|
in its interface. It uses the kernel
|
|
|
|
|
class `Kernel` used in the polyhedron type to define an instance of the
|
|
|
|
|
adapter traits class `CGAL::Convex_hull_d_traits_3<Kernel>`.
|
|
|
|
|
adapter traits class `::Convex_hull_d_traits_3<Kernel>`.
|
|
|
|
|
|
|
|
|
|
In almost all cases, the static and the dynamic version will
|
|
|
|
|
be faster than the incremental convex hull algorithm (mainly
|
|
|
|
|
@ -93,10 +93,10 @@ completeness and educational purposes. You should use the dynamic
|
|
|
|
|
version when you need an efficient incremental convex hull algorithm.
|
|
|
|
|
|
|
|
|
|
To use the full functionality available with the \f$ d\f$-dimensional class
|
|
|
|
|
`CGAL::Convex_hull_d<R>` in three dimensions (<I>e.g.</I>, the ability
|
|
|
|
|
`::Convex_hull_d<R>` in three dimensions (<I>e.g.</I>, the ability
|
|
|
|
|
to insert new points and to query if a point lies in the convex hull or not),
|
|
|
|
|
you can instantiate the class `CGAL::Convex_hull_d<K>` with the adapter
|
|
|
|
|
traits class `CGAL::Convex_hull_d_traits_3<K>`, as shown in the following
|
|
|
|
|
you can instantiate the class `::Convex_hull_d<K>` with the adapter
|
|
|
|
|
traits class `::Convex_hull_d_traits_3<K>`, as shown in the following
|
|
|
|
|
example.
|
|
|
|
|
|
|
|
|
|
## Example ##
|
|
|
|
|
@ -106,7 +106,7 @@ example.
|
|
|
|
|
# Dynamic Convex Hull Construction #
|
|
|
|
|
|
|
|
|
|
Fully dynamic maintenance of a convex hull can be achieved by using the
|
|
|
|
|
class `CGAL::Delaunay_triangulation_3`. This class supports insertion
|
|
|
|
|
class `::Delaunay_triangulation_3`. This class supports insertion
|
|
|
|
|
and removal of points (<I>i.e.</I>, vertices of the triangulation) and the
|
|
|
|
|
convex hull edges are simply the finite edges of infinite faces.
|
|
|
|
|
The following example illustrates the dynamic construction of a convex hull.
|
|
|
|
|
@ -125,10 +125,10 @@ not all of them are vertices of the hull.
|
|
|
|
|
# Performance #
|
|
|
|
|
|
|
|
|
|
In the following, we compare the running times of the three approaches to compute 3D convex hulls.
|
|
|
|
|
For the static version (using `CGAL::convex_hull_3`) and the dynamic version
|
|
|
|
|
(using `CGAL::Delaunay_triangulation_3` and `CGAL::convex_hull_3_to_polyhedron_3`), the kernel
|
|
|
|
|
used was `CGAL::Exact_predicates_inexact_constructions_kernel`. For the incremental version
|
|
|
|
|
(using `CGAL::convex_hull_incremental_3`), the kernel used was `CGAL::Exact_predicates_exact_constructions_kernel`.
|
|
|
|
|
For the static version (using `::convex_hull_3`) and the dynamic version
|
|
|
|
|
(using `::Delaunay_triangulation_3` and `::convex_hull_3_to_polyhedron_3`), the kernel
|
|
|
|
|
used was `::Exact_predicates_inexact_constructions_kernel`. For the incremental version
|
|
|
|
|
(using `::convex_hull_incremental_3`), the kernel used was `::Exact_predicates_exact_constructions_kernel`.
|
|
|
|
|
|
|
|
|
|
To compute the convex hull of a million of random points in a unit ball the static approach needed 1.63s, while
|
|
|
|
|
the dynamic and incremental approaches needed 9.50s and 11.54s respectively.
|
|
|
|
|
|