Changes after the review by Sebastien
This commit is contained in:
@@ -4,28 +4,28 @@ namespace CGAL {
|
||||
\ingroup PkgConvexHull3Functions
|
||||
|
||||
\brief computes robustly the intersection of the halfspaces defined by the planes contained in the range [`begin`, `end`) without constructing the dual points. The result is stored in the polyhedron `P`.
|
||||
If `origin` is given then it must be a point strictly inside the polyhedron. If an interior point is not given then it is computed using a linear program and thus is slower.
|
||||
If `origin` is given then it must be a point strictly inside the polygon mesh. If an interior point is not given then it is computed using a linear program and thus is slower.
|
||||
|
||||
This version does not construct the dual points explicitely but uses a special traits class for the function `CGAL::convex_hull_3()` to handle predicates on dual points without constructing them.
|
||||
|
||||
\attention Halfspaces are considered as lower halfspaces that is to say if the plane's equation is \f$ a\, x +b\, y +c\, z + d = 0 \f$ then the corresponding halfspace is defined by \f$ a\, x +b\, y +c\, z + d \le 0 \f$ .
|
||||
\attention
|
||||
|
||||
\pre The point type of `origin` and the point type of the vertices of `Polyhedron` must come from the same \cgal %Kernel.\pre if provided, `origin` is inside the intersection of halfspaces defined by the range `[begin, end)`.
|
||||
\pre The point type of `origin` and the point type of the vertices of `PolygonMesh` must come from the same \cgal %Kernel.\pre if provided, `origin` is inside the intersection of halfspaces defined by the range `[begin, end)`.
|
||||
\pre The computed intersection must be a bounded convex polyhedron.
|
||||
|
||||
|
||||
\tparam PlaneIterator must be an input iterator where the value type is a model of the
|
||||
concept `Kernel::Plane_3` and this plane type must come from the same kernel as the point type.
|
||||
|
||||
\tparam Polyhedron must be a model of `MutableFaceGraph`.
|
||||
\tparam PolygonMesh must be a model of `MutableFaceGraph`.
|
||||
|
||||
\sa `halfspace_intersection_with_constructions_3()`
|
||||
*/
|
||||
|
||||
template <class PlaneIterator, class Polyhedron>
|
||||
template <class PlaneIterator, class PolygonMesh>
|
||||
void halfspace_intersection_3 (PlaneIterator begin, PlaneIterator end,
|
||||
Polyhedron &P,
|
||||
PolygonMesh &P,
|
||||
boost::optional<Kernel_traits<std::iterator_traits<PlaneIterator>::value_type>::Kernel::Point_3> > origin = boost::none);
|
||||
|
||||
} /* namespace CGAL */
|
||||
|
||||
+4
-4
@@ -15,17 +15,17 @@ This version constructs explicitly the dual points using the convex hull algorit
|
||||
|
||||
\tparam PlaneIterator must be an input iterator where the value type is a model of the
|
||||
concept `Kernel::Plane_3` and this plane type must come from the same kernel as the point type.
|
||||
\tparam Polyhedron must be a model of `MutableFaceGraph`.
|
||||
\tparam PolygonMesh must be a model of `MutableFaceGraph`.
|
||||
\tparam Traits must be a model of the concept `ConvexHullTraits_3`.
|
||||
|
||||
\sa `halfspace_intersection_3()`
|
||||
*/
|
||||
|
||||
template <class PlaneIterator, class Polyhedron, class Traits>
|
||||
template <class PlaneIterator, class PolygonMesh, class Traits>
|
||||
void halfspace_intersection_with_constructions_3(PlaneIterator pbegin,
|
||||
PlaneIterator pend,
|
||||
Polyhedron &P,
|
||||
boost::optional<Polyhedron::Vertex::Point_3> origin = boost::none,
|
||||
PolygonMesh &P,
|
||||
boost::optional<Kernel_traits<std::iterator_traits<PlaneIterator>::value_type>::Kernel::Point_3> > origin = boost::none,
|
||||
const Traits & ch_traits = Default_traits);
|
||||
|
||||
} /* namespace CGAL */
|
||||
|
||||
@@ -8,12 +8,12 @@ The class `Convex_hull_traits_3` serves as a traits class for the function
|
||||
function when `R` is a kernel with exact predicates but inexact constructions
|
||||
(note that the type `Plane_3` is a triple of `Point_3` and not `R::Plane_3`).
|
||||
|
||||
\tparam MFG must be a model of MutableFaceGraph
|
||||
\tparam MFG must be a model of the concept `MutableFaceGraph`
|
||||
\cgalModels `ConvexHullTraits_3`
|
||||
\cgalModels `IsStronglyConvexTraits_3`
|
||||
|
||||
*/
|
||||
template< typename R, typename MFG = Polyhedron_3<R> >
|
||||
template< typename R, typename PolygonMesh = Polyhedron_3<R> >
|
||||
class Convex_hull_traits_3 {
|
||||
public:
|
||||
|
||||
@@ -43,7 +43,7 @@ typedef unspecified_type Plane_3;
|
||||
/*!
|
||||
|
||||
*/
|
||||
typedef MFG Polyhedron_3;
|
||||
typedef PolygonMesh Polygon_mesh;
|
||||
|
||||
/*!
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ that is `P` will contain only triangular facets.
|
||||
[`first`, `last`) not all of which are collinear.
|
||||
|
||||
\tparam InputIterator must be an input iterator with a value type equivalent to `Traits::Point_3`.
|
||||
\tparam Polyhedron_3 must be a model of `MutableFaceGraph`.
|
||||
\tparam PolygonMesh must be a model of `MutableFaceGraph`.
|
||||
\tparam Traits must be a model of the concept `ConvexHullTraits_3`.
|
||||
For the purposes of checking the postcondition that the convex hull
|
||||
is valid, `Traits` must also be a model of the concept
|
||||
@@ -35,8 +35,8 @@ Barnard <I>et al.</I> \cgalCite{bdh-qach-96}.
|
||||
|
||||
*/
|
||||
|
||||
template <class InputIterator, class Polyhedron_3, class Traits>
|
||||
void convex_hull_3(InputIterator first, InputIterator last, Polyhedron_3& P, const Traits& ch_traits = Default_traits);
|
||||
template <class InputIterator, class PolygonMesh, class Traits>
|
||||
void convex_hull_3(InputIterator first, InputIterator last, PolygonMesh& P, const Traits& ch_traits = Default_traits);
|
||||
|
||||
/*!
|
||||
\ingroup PkgConvexHull3Functions
|
||||
@@ -54,7 +54,7 @@ in case the result is a polyhedron.
|
||||
\tparam Traits must be model of the concept `ConvexHullTraits_3`.
|
||||
For the purposes of checking the postcondition that the convex hull
|
||||
is valid, `Traits` must also be a model of the concept
|
||||
`IsStronglyConvexTraits_3`. Furthermore, `Traits` must define a type `Polyhedron_3` that is a model of
|
||||
`IsStronglyConvexTraits_3`. Furthermore, `Traits` must define a type `PolygonMesh` that is a model of
|
||||
`MutableFaceGraph`.
|
||||
|
||||
If the kernel `R` of the points determined by the value type of `InputIterator`
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace CGAL {
|
||||
|
||||
/*!
|
||||
\ingroup PkgConvexHull3Functions
|
||||
|
||||
fills a polyhedron with the convex hull of a set of 3D points contained in a 3D triangulation of \cgal.
|
||||
|
||||
The polyhedron `P` is cleared and the convex hull of the set of 3D points is stored in `P`.
|
||||
|
||||
\attention This function does not compute the plane equations of the faces of `P`.
|
||||
|
||||
\pre `T.dimension()`==3.
|
||||
|
||||
\tparam Triangulation must be a \cgal 3D triangulation
|
||||
\tparam PolygonMesh must be a model of the concept `MutableFaceGraph`
|
||||
|
||||
\sa `convex_hull_3()`
|
||||
\sa `link_to_face_graph()`
|
||||
|
||||
*/
|
||||
template <class Triangulation, class PolygonMesh>
|
||||
void convex_hull_3_to_face_graph(const Triangulation& T,PolygonMesh& P);
|
||||
|
||||
} /* namespace CGAL */
|
||||
@@ -7,6 +7,8 @@ fills a polyhedron with the convex hull of a set of 3D points contained in a 3D
|
||||
|
||||
The polyhedron `P` is cleared and the convex hull of the set of 3D points is stored in `P`.
|
||||
|
||||
\deprecated since \cgal 4.10. Use `convex_hull_to_face_graph() instead.
|
||||
|
||||
\attention This function does not compute the plane equations of the faces of `P`.
|
||||
|
||||
\attention This function works only for `CGAL::Polyhedron_3<Traits>`, and users who want
|
||||
|
||||
@@ -9,7 +9,7 @@ to be strongly convex if it consists of only extreme points (i.e.,
|
||||
vertices of the convex hull).
|
||||
|
||||
|
||||
\tparam Polyhedron must be a model of the concept`FaceListGraph`.
|
||||
\tparam PolygonMesh must be a model of the concept`FaceListGraph`.
|
||||
\tparam Traits must be a model of the concept `IsStronglyConvexTraits_3`.
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ determine convexity and requires \f$ O(e + f)\f$ time for a polyhedron with
|
||||
|
||||
*/
|
||||
|
||||
template<class Polyhedron, class Traits>
|
||||
bool is_strongly_convex_3(Polyhedron& P,
|
||||
template<class PolygonMesh, class Traits>
|
||||
bool is_strongly_convex_3(PolygonMesh& P,
|
||||
const Traits& traits = Default_traits);
|
||||
|
||||
} /* namespace CGAL */
|
||||
|
||||
@@ -128,16 +128,16 @@ not all of them are vertices of the hull.
|
||||
The following example shows how to compute a convex hull with a triangulation.
|
||||
The vertices incident to the infinite vertex are on the convex hull.
|
||||
|
||||
The function `link_to_face_graph()` can be used to obtain a polyhedral surface
|
||||
The function `convex_hull_3_to_face_graph()` can be used to obtain a polyhedral surface
|
||||
that is model of the concept `MutableFaceGraph`, e.g. `Polyhedron_3` and `Surface_mesh`.
|
||||
|
||||
\cgalExample{Convex_hull_3/dynamic_hull_3.cpp}
|
||||
|
||||
\section Convex_hull_3Performance Performance
|
||||
|
||||
In the following, we compare the running times of the three approaches to compute 3D convex hulls.
|
||||
In the following, we compare the running times of the two approaches to compute 3D convex hulls.
|
||||
For the static version (using `convex_hull_3()`) and the dynamic version
|
||||
(using `Delaunay_triangulation_3` and `link_to_face_graph()`), the kernel
|
||||
(using `Delaunay_triangulation_3` and `convex_hull_3_to_face_graph()`), the kernel
|
||||
used was `Exact_predicates_inexact_constructions_kernel`.
|
||||
|
||||
To compute the convex hull of a million of random points in a unit ball the static approach needed 1.63s, while
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <CGAL/Delaunay_triangulation_3.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/algorithm.h>
|
||||
#include <CGAL/link_to_face_graph.h>
|
||||
#include <CGAL/convex_hull_3_to_face_graph.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
@@ -40,7 +40,7 @@ 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::link_to_face_graph(T, T.infinite_vertex(), 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;
|
||||
|
||||
@@ -14,7 +14,7 @@ typedef K::Plane_3 Plane;
|
||||
typedef K::Vector_3 Vector;
|
||||
|
||||
typedef CGAL::Convex_hull_traits_3<K> Traits;
|
||||
typedef Traits::Polyhedron_3 Polyhedron;
|
||||
typedef Traits::Polygon_mesh Polyhedron;
|
||||
|
||||
typedef CGAL::Delaunay_triangulation_3<K> DT;
|
||||
typedef DT::Vertex_handle Vertex_handle;
|
||||
|
||||
@@ -199,7 +199,8 @@ class Convex_hull_traits_3 :
|
||||
typedef Point_triple<R> Plane_3;
|
||||
typedef typename R::Vector_3 Vector_3;
|
||||
|
||||
typedef typename Default::Get<Polyhedron, CGAL::Polyhedron_3<R> >::type Polyhedron_3;
|
||||
typedef typename Default::Get<Polyhedron, CGAL::Polyhedron_3<R> >::type Polygon_mesh;
|
||||
// typedef Polyhedron_3;
|
||||
|
||||
typedef typename R::Construct_segment_3 Construct_segment_3;
|
||||
typedef typename R::Construct_ray_3 Construct_ray_3;
|
||||
|
||||
@@ -82,7 +82,7 @@ struct Default_polyhedron_for_Chull_3{
|
||||
|
||||
template <class K, class P, class Tag>
|
||||
struct Default_polyhedron_for_Chull_3<Convex_hull_traits_3<K, P, Tag> >{
|
||||
typedef typename Convex_hull_traits_3<K, P, Tag>::Polyhedron_3 type;
|
||||
typedef typename Convex_hull_traits_3<K, P, Tag>::Polygon_mesh type;
|
||||
};
|
||||
|
||||
//utility class to select the right version of internal predicate Is_on_positive_side_of_plane_3
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2011 GeometryFactory (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Sebastien Loriot
|
||||
//
|
||||
|
||||
#ifndef CGAL_CONVEX_HULL_3_TO_FACE_GRAPH_3_H
|
||||
#define CGAL_CONVEX_HULL_3_TO_FACE_GRAPH_3_H
|
||||
|
||||
#include <CGAL/link_to_face_graph.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
||||
template<class Triangulation_3,class PolygonMesh>
|
||||
void convex_hull_3_to_face_graph(const Triangulation_3& T,PolygonMesh& P){
|
||||
link_to_face_graph(T,T.infinite_vertex(), P);
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif //CGAL_CONVEX_HULL_3_TO_FACE_GRAPH_3_H
|
||||
@@ -19,12 +19,12 @@
|
||||
// Author(s) : Sebastien Loriot
|
||||
//
|
||||
|
||||
#include <CGAL/Polyhedron_incremental_builder_3.h>
|
||||
#include <CGAL/Modifier_base.h>
|
||||
|
||||
#ifndef CGAL_CONVEX_HULL_3_TO_POLYHEDRON_3_H
|
||||
#define CGAL_CONVEX_HULL_3_TO_POLYHEDRON_3_H
|
||||
|
||||
#include <CGAL/Polyhedron_incremental_builder_3.h>
|
||||
#include <CGAL/Modifier_base.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class HDS,class Triangulation>
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
};
|
||||
|
||||
template<class Triangulation_3,class Polyhedron_3>
|
||||
void convex_hull_3_to_polyhedron_3(const Triangulation_3& T,Polyhedron_3& P){
|
||||
CGAL_DEPRECATED void convex_hull_3_to_polyhedron_3(const Triangulation_3& T,Polyhedron_3& P){
|
||||
P.clear();
|
||||
Convex_hull_modifier_from_triangulation_3<typename Polyhedron_3::HalfedgeDS,Triangulation_3> modifier(T);
|
||||
P.delegate(modifier);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
typedef CGAL::Exact_rational Exact_rational;
|
||||
typedef CGAL::Cartesian< Exact_rational > R;
|
||||
typedef CGAL::Convex_hull_traits_3<R> Traits;
|
||||
typedef Traits::Polyhedron_3 Polyhedron_3;
|
||||
typedef Traits::Polygon_mesh Polyhedron_3;
|
||||
|
||||
typedef R::Point_2 Point_2;
|
||||
typedef R::Point_3 Point_3;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
typedef CGAL::Exact_rational NT;
|
||||
typedef CGAL::Cartesian<NT> K;
|
||||
typedef CGAL::Convex_hull_traits_3<K> Traits;
|
||||
typedef Traits::Polyhedron_3 Polyhedron_3;
|
||||
typedef Traits::Polygon_mesh Polyhedron_3;
|
||||
|
||||
typedef K::Point_3 Point_3;
|
||||
typedef K::Segment_3 Segment_3;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <CGAL/array.h>
|
||||
#include <CGAL/boost/graph/Euler_operations.h>
|
||||
#include <CGAL/boost/graph/helpers.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
@@ -42,6 +43,7 @@ link_to_face_graph(const Triangulation_3& t,
|
||||
typedef typename Triangulation_3::Vertex_handle Vertex_handle;
|
||||
typedef typename boost::graph_traits<FG>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
clear(fg);
|
||||
vertex_descriptor inf;
|
||||
vertex_descriptor nullvertex = boost::graph_traits<FG>::null_vertex();
|
||||
fg.clear();
|
||||
|
||||
Reference in New Issue
Block a user