From 2c53823d43c0557bbbce4e67cddceee1eda12f47 Mon Sep 17 00:00:00 2001 From: Susan Hert Date: Tue, 30 Apr 2002 19:21:49 +0000 Subject: [PATCH] - Used specific CGAL::Polyhedron_3 in convex_hull_3 functions to get M$ to understand. --- Packages/Convex_hull_3/changes.txt | 4 + .../include/CGAL/convex_hull_3.h | 238 +++++++++++++++--- 2 files changed, 211 insertions(+), 31 deletions(-) diff --git a/Packages/Convex_hull_3/changes.txt b/Packages/Convex_hull_3/changes.txt index f53b8012b81..80e281e5c4d 100644 --- a/Packages/Convex_hull_3/changes.txt +++ b/Packages/Convex_hull_3/changes.txt @@ -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 diff --git a/Packages/Convex_hull_3/include/CGAL/convex_hull_3.h b/Packages/Convex_hull_3/include/CGAL/convex_hull_3.h index 5c3be6f3da1..81c43def463 100644 --- a/Packages/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Packages/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -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 // chapter : Convex Hulls and Extreme Points // @@ -25,7 +25,7 @@ // coordinator : MPI (Susan Hert ) // // 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 +template void partition_outside_sets(const std::list& new_facets, std::list& vis_outside_set, - CGAL::Unique_hash_map >& outside_sets, + //CGAL::Unique_hash_map >& outside_sets, + UHM& outside_sets, std::list& pending_facets, const Traits& traits) { @@ -285,18 +285,57 @@ partition_outside_sets(const std::list& new_facets, if (!outside_sets[*f_list_it].empty()) pending_facets.push_back(*f_list_it); } + } -template +// +// 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 void -ch_quickhull_3_scan( +ch_quickhull_3_scan(Polyhedron_3& P, + std::list::Facet_handle>& pending_facets, + CGAL::Unique_hash_map::Facet_handle, + std::list >& 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& P, + std::list::Facet_handle>& pending_facets, + CGAL::Unique_hash_map::Facet_handle, + std::list >& outside_sets, const Traits& traits +) +#endif // CGAL_USE_POLYHEDRON_DESIGN_ONE // + +#else // non-MSVC compilers can handle this more general interface + +template +void +ch_quickhull_3_scan( Polyhedron_3& P, std::list& pending_facets, - CGAL::Unique_hash_map >& outside_sets, const Traits& traits) +#endif // _MSC_VER { + +#if defined(_MSC_VER) + typedef Polyhedron_3 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 +void non_coplanar_quickhull_3(std::list& points, + Polyhedron_3& 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& points, + Polyhedron_3& P, const Traits& traits) +#endif // CGAL_USE_POLYHEDRON_DESIGN_ONE // + +#else // non-MSVC compilers can handle this more general interface + template void non_coplanar_quickhull_3(std::list& points, Polyhedron_3& P, const Traits& traits) +#endif // _MSC_VER + { +#if defined (_MSC_VER) + typedef typename Polyhedron_3::Facet_handle + Facet_handle; + typedef typename Polyhedron_3::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 > Outside_set_map; @@ -460,22 +533,62 @@ void non_coplanar_quickhull_3(std::list& 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(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 + + +// +// 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 void -ch_quickhull_polyhedron_3(std::list& points, - typename std::list::iterator point1_it, - typename std::list::iterator point2_it, - typename std::list::iterator point3_it, - Polyhedron_3& P, - const Traits& traits) +ch_quickhull_polyhedron_3(std::list& points, + InputIterator point1_it, + InputIterator point2_it, + InputIterator point3_it, + Polyhedron_3& 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& points, + InputIterator point1_it, + InputIterator point2_it, + InputIterator point3_it, + Polyhedron_3& P, + const Traits& traits + ) +#endif // CGAL_USE_POLYHEDRON_DESIGN_ONE // + +#else // non-MSVC compilers can handle this more general interface + +template +void +ch_quickhull_polyhedron_3(std::list& 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& points, points.erase(point3_it); points.erase(max_it); if (!points.empty()) - non_coplanar_quickhull_3(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()); } -template + +// +// 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 void convex_hull_3(InputIterator first, InputIterator beyond, + Polyhedron_3& 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& polyhedron, + const Traits& traits) +#endif // CGAL_USE_POLYHEDRON_DESIGN_ONE // + +#else // non-MSVC compilers can handle this more general version + +template +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_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_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 +// +// 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 void convex_hull_3(InputIterator first, InputIterator beyond, - Polyhedron_3& polyhedron CGAL_MSVC_DUMMY_ARGUMENT) + Polyhedron_3& 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& polyhedron + CGAL_MSVC_DUMMY_ARGUMENT) + +#endif // CGAL_USE_POLYHEDRON_DESIGN_ONE // + +#else // non-MSVC compilers can handle this simpler, more general version + +template +void convex_hull_3(InputIterator first, InputIterator beyond, + Polyhedron_3& polyhedron) + +#endif // _MSC_VER { typedef typename std::iterator_traits::value_type Point_3; typedef typename Kernel_traits::Kernel K;