- Used specific CGAL::Polyhedron_3 in convex_hull_3 functions to get M$ to

understand.
This commit is contained in:
Susan Hert 2002-04-30 19:21:49 +00:00
parent 0e5cac8d46
commit 2c53823d43
2 changed files with 211 additions and 31 deletions

View File

@ -1,3 +1,7 @@
2.37 (30 Apr 2002)
- Used specific CGAL::Polyhedron_3 in convex_hull_3 functions to get M$ to
understand.
2.36 (22 Mar 2002)
- removed one of the tests since it used coordinates not appropriate for
the number types used in the test suite

View File

@ -1,4 +1,4 @@
// ============================================================================
// ======================================================================
//
// Copyright (c) 2001 The CGAL Consortium
//
@ -6,13 +6,13 @@
// of the Computational Geometry Algorithms Library (CGAL). It is not
// intended for general use.
//
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------
//
// release : $CGAL_Revision $
// release_date : $CGAL_Date $
// release : $CGAL_Revision: CGAL-2.4-I-82 $
// release_date : $CGAL_Date: 2002/04/26 $
//
// file : include/CGAL/convex_hull_3.h
// package : $CGAL_Package: Convex_hull_3 $
// package : Convex_hull_3 (2.36)
// maintainer : Susan Hert <hert@mpi-sb.mpg.de>
// chapter : Convex Hulls and Extreme Points
//
@ -25,7 +25,7 @@
// coordinator : MPI (Susan Hert <hert@mpi-sb.mpg.de>)
//
// implementation: 3D convex hull via quickhull algorithm
// ============================================================================
// ======================================================================
#ifndef CGAL_CONVEX_HULL_3_H
#define CGAL_CONVEX_HULL_3_H
@ -244,12 +244,12 @@ void compute_plane_equation(Facet_handle f)
*/
}
template <class Facet_handle, class Traits>
template <class Facet_handle, class Traits, class UHM>
void
partition_outside_sets(const std::list<Facet_handle>& new_facets,
std::list<typename Traits::Point_3>& vis_outside_set,
CGAL::Unique_hash_map<Facet_handle,
std::list<typename Traits::Point_3> >& outside_sets,
//CGAL::Unique_hash_map<Facet_handle, std::list<typename Traits::Point_3> >& outside_sets,
UHM& outside_sets,
std::list<Facet_handle>& pending_facets,
const Traits& traits)
{
@ -285,18 +285,57 @@ partition_outside_sets(const std::list<Facet_handle>& new_facets,
if (!outside_sets[*f_list_it].empty())
pending_facets.push_back(*f_list_it);
}
}
template <class Polyhedron_3, class Traits>
//
// the MSVC 6.0 and 7.0 compilers cannot deal with function overloading
// very well, so we have to use specific templating here with the CGAL
// Polyhedron_3 type in its two different forms (one that is swallowed by
// MSVC6 and the other by MSVC 7.0.
//
#if defined(_MSC_VER)
#ifdef CGAL_USE_POLYHEDRON_DESIGN_ONE
template <class Tr, class Traits, class HDS>
void
ch_quickhull_3_scan(
ch_quickhull_3_scan(Polyhedron_3<Tr,HDS>& P,
std::list<typename Polyhedron_3<Tr,HDS>::Facet_handle>& pending_facets,
CGAL::Unique_hash_map<typename Polyhedron_3<Tr,HDS>::Facet_handle,
std::list<typename Traits::Point_3> >& outside_sets,
const Traits& traits)
#else // CGAL_USE_POLYHEDRON_DESIGN_ONE //
template < class Tr, class Traits, class Items,
#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM
template < class T, class I, class A>
#endif
class HDS, class Alloc>
void
ch_quickhull_3_scan(Polyhedron_3<Tr,Items,HDS,Alloc>& P,
std::list<typename Polyhedron_3<Tr,Items,HDS,Alloc>::Facet_handle>& pending_facets,
CGAL::Unique_hash_map<typename Polyhedron_3<Tr,Items,HDS,Alloc>::Facet_handle,
std::list<typename Traits::Point_3> >& outside_sets, const Traits& traits
)
#endif // CGAL_USE_POLYHEDRON_DESIGN_ONE //
#else // non-MSVC compilers can handle this more general interface
template <class Polyhedron_3, class Traits>
void
ch_quickhull_3_scan(
Polyhedron_3& P,
std::list<typename Polyhedron_3::Facet_handle>& pending_facets,
CGAL::Unique_hash_map<typename Polyhedron_3::Facet_handle,
CGAL::Unique_hash_map<typename Polyhedron_3::Facet_handle,
std::list<typename Traits::Point_3> >& outside_sets,
const Traits& traits)
#endif // _MSC_VER
{
#if defined(_MSC_VER)
typedef Polyhedron_3<Tr,Items,HDS,Alloc> Polyhedron;
#else
typedef Polyhedron_3 Polyhedron;
#endif // _MSC_VER
typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
typedef typename Polyhedron::Halfedge_iterator Halfedge_iterator;
typedef typename Polyhedron::Facet_handle Facet_handle;
@ -410,15 +449,49 @@ ch_quickhull_3_scan(
// now partition the set of outside set points among the new facets.
partition_outside_sets(new_facets, vis_outside_set, outside_sets,
pending_facets, traits);
}
}
}
//
// the MSVC 6.0 and 7.0 compilers cannot deal with function overloading
// very well, so we have to use specific templating here with the CGAL
// Polyhedron_3 type in its two different forms (one that is swallowed by
// MSVC6 and the other by MSVC 7.0.
//
#if defined(_MSC_VER)
#ifdef CGAL_USE_POLYHEDRON_DESIGN_ONE
template <class Tr, class Traits, class HDS>
void non_coplanar_quickhull_3(std::list<typename Traits::Point_3>& points,
Polyhedron_3<Tr,HDS>& P, const Traits& traits)
#else // CGAL_USE_POLYHEDRON_DESIGN_ONE //
template < class Tr, class Traits, class Items,
#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM
template < class T, class I, class A>
#endif
class HDS, class Alloc>
void non_coplanar_quickhull_3(std::list<typename Traits::Point_3>& points,
Polyhedron_3<Tr,Items,HDS,Alloc>& P, const Traits& traits)
#endif // CGAL_USE_POLYHEDRON_DESIGN_ONE //
#else // non-MSVC compilers can handle this more general interface
template <class Polyhedron_3, class Traits>
void non_coplanar_quickhull_3(std::list<typename Traits::Point_3>& points,
Polyhedron_3& P, const Traits& traits)
#endif // _MSC_VER
{
#if defined (_MSC_VER)
typedef typename Polyhedron_3<Tr,Items,HDS,Alloc>::Facet_handle
Facet_handle;
typedef typename Polyhedron_3<Tr,Items,HDS,Alloc>::Facet_iterator
Facet_iterator;
#else
typedef typename Polyhedron_3::Facet_handle Facet_handle;
typedef typename Polyhedron_3::Facet_iterator Facet_iterator;
#endif
typedef typename Traits::Point_3 Point_3;
typedef CGAL::Unique_hash_map<Facet_handle, std::list<Point_3> >
Outside_set_map;
@ -460,22 +533,62 @@ void non_coplanar_quickhull_3(std::list<typename Traits::Point_3>& points,
for (f_it = P.facets_begin(); f_it != P.facets_end(); f_it++)
if (!outside_sets[f_it].empty())
pending_facets.push_back(f_it);
ch_quickhull_3_scan<Polyhedron_3, Traits>(P, pending_facets, outside_sets,
traits);
ch_quickhull_3_scan(P, pending_facets, outside_sets, traits);
CGAL_ch_expensive_postcondition(all_points_inside(points.begin(),
points.end(),P,traits));
CGAL_ch_postcondition(is_strongly_convex_3(P, traits));
}
template <class Polyhedron_3, class Traits>
//
// the MSVC 6.0 and 7.0 compilers cannot deal with function overloading
// very well, so we have to use specific templating here with the CGAL
// Polyhedron_3 type in its two different forms (one that is swallowed by
// MSVC6 and the other by MSVC 7.0.
//
#if defined(_MSC_VER)
#ifdef CGAL_USE_POLYHEDRON_DESIGN_ONE
template <class Tr, class HDS, class Traits, class type, class InputIterator>
void
ch_quickhull_polyhedron_3(std::list<typename Traits::Point_3>& points,
typename std::list<typename Traits::Point_3>::iterator point1_it,
typename std::list<typename Traits::Point_3>::iterator point2_it,
typename std::list<typename Traits::Point_3>::iterator point3_it,
Polyhedron_3& P,
const Traits& traits)
ch_quickhull_polyhedron_3(std::list<type>& points,
InputIterator point1_it,
InputIterator point2_it,
InputIterator point3_it,
Polyhedron_3<Tr,HDS>& P,
const Traits& traits
)
#else // CGAL_USE_POLYHEDRON_DESIGN_ONE //
template < class InputIterator, class Tr, class Traits,
class Items,
#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM
template < class T, class I, class A>
#endif
class HDS, class Alloc
>
void
ch_quickhull_polyhedron_3(std::list<typename Traits::Point_3>& points,
InputIterator point1_it,
InputIterator point2_it,
InputIterator point3_it,
Polyhedron_3<Tr,Items,HDS,Alloc>& P,
const Traits& traits
)
#endif // CGAL_USE_POLYHEDRON_DESIGN_ONE //
#else // non-MSVC compilers can handle this more general interface
template <class InputIterator, class Polyhedron_3, class Traits>
void
ch_quickhull_polyhedron_3(std::list<typename Traits::Point_3>& points,
InputIterator point1_it, InputIterator point2_it,
InputIterator point3_it, Polyhedron_3& P,
const Traits& traits)
#endif // _MSC_VER
{
typedef typename Traits::Point_3 Point_3;
typedef typename Traits::Plane_3 Plane_3;
@ -536,7 +649,7 @@ ch_quickhull_polyhedron_3(std::list<typename Traits::Point_3>& points,
points.erase(point3_it);
points.erase(max_it);
if (!points.empty())
non_coplanar_quickhull_3<Polyhedron_3, Traits>(points, P, traits);
non_coplanar_quickhull_3(points, P, traits);
}
}
@ -636,14 +749,48 @@ void convex_hull_3(InputIterator first, InputIterator beyond,
convex_hull_3(first, beyond, ch_object, Convex_hull_traits_3<K>());
}
template <class InputIterator, class Polyhedron_3, class Traits>
//
// the MSVC 6.0 and 7.0 compilers cannot deal with function overloading
// very well, so we have to use specific templating here with the CGAL
// Polyhedron_3 type in its two different forms (one that is swallowed by
// MSVC6 and the other by MSVC 7.0.
//
#if defined(_MSC_VER)
#ifdef CGAL_USE_POLYHEDRON_DESIGN_ONE
template <class InputIterator, class Tr, class Traits, class HDS>
void convex_hull_3(InputIterator first, InputIterator beyond,
Polyhedron_3<Tr,HDS>& polyhedron, const Traits& traits)
#else // CGAL_USE_POLYHEDRON_DESIGN_ONE //
template < class InputIterator,
class Tr,
class Traits,
class Items,
#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM
template < class T, class I, class A>
#endif
class HDS, class Alloc>
void convex_hull_3(InputIterator first, InputIterator beyond,
Polyhedron_3<Tr,Items,HDS,Alloc>& polyhedron,
const Traits& traits)
#endif // CGAL_USE_POLYHEDRON_DESIGN_ONE //
#else // non-MSVC compilers can handle this more general version
template <class InputIterator, class Polyhedron_3, class Traits>
void convex_hull_3(InputIterator first, InputIterator beyond,
Polyhedron_3& polyhedron, const Traits& traits)
{
typedef typename Traits::Point_3 Point_3;
typedef typename Traits::Plane_3 Plane_3;
typedef std::list<Point_3> Point_3_list;
typedef typename Point_3_list::iterator P3_iterator;
#endif // _MSC_VER
{
typedef typename Traits::Point_3 Point_3;
typedef typename Traits::Plane_3 Plane_3;
#if defined(_MSC_VER)
typedef std::list< Traits::Point_3> Point_3_list;
#else
typedef std::list<Point_3> Point_3_list;
#endif // _MSC_VER
typedef typename Point_3_list::iterator P3_iterator;
Point_3_list points(first, beyond);
CGAL_ch_precondition(points.size() > 3);
@ -669,11 +816,40 @@ void convex_hull_3(InputIterator first, InputIterator beyond,
// result will be a polyhedron
ch_quickhull_polyhedron_3(points, point1_it, point2_it, point3_it,
polyhedron, traits);
}
template <class InputIterator, class Polyhedron_3>
//
// the MSVC 6.0 and 7.0 compilers cannot deal with function overloading
// very well, so we have to use specific templating here with the CGAL
// Polyhedron_3 type in its two different forms (one that is swallowed by
// MSVC6 and the other by MSVC 7.0.
//
#if defined(_MSC_VER)
#ifdef CGAL_USE_POLYHEDRON_DESIGN_ONE
template <class InputIterator, class Traits, class HDS>
void convex_hull_3(InputIterator first, InputIterator beyond,
Polyhedron_3& polyhedron CGAL_MSVC_DUMMY_ARGUMENT)
Polyhedron_3<Traits,HDS>& polyhedron CGAL_MSVC_DUMMY_ARGUMENT)
#else // CGAL_USE_POLYHEDRON_DESIGN_ONE //
template < class InputIterator, class Traits, class Items,
#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM
template < class T, class I, class A>
#endif
class HDS, class Alloc>
void convex_hull_3(InputIterator first, InputIterator beyond,
Polyhedron_3<Traits,Items,HDS,Alloc>& polyhedron
CGAL_MSVC_DUMMY_ARGUMENT)
#endif // CGAL_USE_POLYHEDRON_DESIGN_ONE //
#else // non-MSVC compilers can handle this simpler, more general version
template <class InputIterator, class Polyhedron_3>
void convex_hull_3(InputIterator first, InputIterator beyond,
Polyhedron_3& polyhedron)
#endif // _MSC_VER
{
typedef typename std::iterator_traits<InputIterator>::value_type Point_3;
typedef typename Kernel_traits<Point_3>::Kernel K;