diff --git a/Convex_hull_3/include/CGAL/Convex_hull_face_base_2.h b/Convex_hull_3/include/CGAL/Convex_hull_face_base_2.h index f44372153cd..223dcf5a225 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_face_base_2.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_face_base_2.h @@ -17,18 +17,19 @@ #include +#include #include -#include namespace CGAL { template < typename Info_, typename GT, - typename Fb = Triangulation_face_base_2 > + typename Fb = Triangulation_ds_face_base_2< > > class Convex_hull_face_base_2 : public Fb { Info_ _info; + public: typedef typename Fb::Vertex_handle Vertex_handle; typedef typename Fb::Face_handle Face_handle; @@ -36,6 +37,7 @@ public: typename std::list::iterator it; std::list points; + template < typename TDS2 > struct Rebind_TDS { typedef typename Fb::template Rebind_TDS::Other Fb2; @@ -46,20 +48,23 @@ public: : Fb(), _info(0) {} Convex_hull_face_base_2(Vertex_handle v0, - Vertex_handle v1, - Vertex_handle v2) + Vertex_handle v1, + Vertex_handle v2) : Fb(v0, v1, v2), _info(0) {} Convex_hull_face_base_2(Vertex_handle v0, - Vertex_handle v1, - Vertex_handle v2, - Face_handle n0, - Face_handle n1, - Face_handle n2 ) + Vertex_handle v1, + Vertex_handle v2, + Face_handle n0, + Face_handle n1, + Face_handle n2 ) : Fb(v0, v1, v2, n0, n1, n2), _info(0) {} const Info& info() const { return _info; } Info& info() { return _info; } + + static int ccw(int i) {return Triangulation_cw_ccw_2::ccw(i);} + static int cw(int i) {return Triangulation_cw_ccw_2::cw(i);} }; } //namespace CGAL diff --git a/Convex_hull_3/include/CGAL/Convex_hull_traits_3.h b/Convex_hull_3/include/CGAL/Convex_hull_traits_3.h index 5746d8293d3..4cf555e37b3 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_traits_3.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_traits_3.h @@ -15,18 +15,16 @@ #include - #include -#include #include #include #include -#include #include #include #include namespace CGAL { + template < class R_ > class Point_triple { diff --git a/Convex_hull_3/include/CGAL/Convex_hull_vertex_base_2.h b/Convex_hull_3/include/CGAL/Convex_hull_vertex_base_2.h new file mode 100644 index 00000000000..c5e61869857 --- /dev/null +++ b/Convex_hull_3/include/CGAL/Convex_hull_vertex_base_2.h @@ -0,0 +1,86 @@ +// Copyright (c) 2011 Max-Planck-Institute Saarbruecken (Germany). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Mael Rouxel-Labbé + +// vertex of a triangulation of any dimension <= 3 + +#ifndef CGAL_CONVEX_HULL_VERTEX_BASE_2_H +#define CGAL_CONVEX_HULL_VERTEX_BASE_2_H + +#include + +#include + +#include + +namespace CGAL { + +template < typename Info_, typename GT, + typename Vb = Triangulation_ds_vertex_base_2< > > +class Convex_hull_vertex_base_2 + : public Vb +{ +public: + typedef Info_ Info; + typedef typename GT::Point_2 Point; + + typedef typename Vb::Face_handle Face_handle; + typedef typename Vb::Vertex_handle Vertex_handle; + +private: + Info _info; + Point _p; + +public: + template < typename TDS2 > + struct Rebind_TDS + { + typedef typename Vb::template Rebind_TDS::Other Vb2; + typedef Convex_hull_vertex_base_2 Other; + }; + + Convex_hull_vertex_base_2() + : Vb() {} + + Convex_hull_vertex_base_2(const Point& p) + : Vb(), _p(p) {} + + Convex_hull_vertex_base_2(const Point& p, Face_handle f) + : Vb(f), _p(p) {} + + Convex_hull_vertex_base_2(Face_handle f) + : Vb(f) {} + + void set_point(const Point& p) { _p = p; } + const Point& point() const { return _p; } + Point& point() { return _p; } + + const Info& info() const { return _info; } + Info& info() { return _info; } +}; + +template +std::istream& +operator>>(std::istream &is, Convex_hull_vertex_base_2& v) +{ + return is >> static_cast(v) >> v.point(); +} + +template +std::ostream& +operator<<(std::ostream &os, const Convex_hull_vertex_base_2& v) +{ + return os << static_cast(v) << v.point(); +} + +} //namespace CGAL + +#endif // CGAL_CONVEX_HULL_VERTEX_BASE_2_H diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index 20b12772563..97ae55493fb 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -17,18 +17,16 @@ #include -#include - -#include #include #include +#include +#include +#include +#include #include #include #include -#include -#include #include -#include #include #include @@ -772,15 +770,15 @@ ch_quickhull_face_graph(std::list& points, const Traits& traits) { typedef typename Traits::Point_3 Point_3; - typedef typename Traits::Plane_3 Plane_3; - typedef typename std::list::iterator P3_iterator; + typedef typename Traits::Plane_3 Plane_3; + typedef typename std::list::iterator P3_iterator; typedef Triangulation_data_structure_2< - Triangulation_vertex_base_with_info_2 >, - Convex_hull_face_base_2 > Tds; + Convex_hull_vertex_base_2 >, + Convex_hull_face_base_2 > Tds; - typedef typename Tds::Vertex_handle Vertex_handle; - typedef typename Tds::Face_handle Face_handle; + typedef typename Tds::Vertex_handle Vertex_handle; + typedef typename Tds::Face_handle Face_handle; // found three points that are not collinear, so construct the plane defined // by these points and then find a point that has maximum distance from this @@ -1111,6 +1109,4 @@ extreme_points_3(const InputRange& range, OutputIterator out) } // namespace CGAL -#include - #endif // CGAL_CONVEX_HULL_3_H diff --git a/Convex_hull_3/package_info/Convex_hull_3/dependencies b/Convex_hull_3/package_info/Convex_hull_3/dependencies index ecc6d422e1b..406722ba9af 100644 --- a/Convex_hull_3/package_info/Convex_hull_3/dependencies +++ b/Convex_hull_3/package_info/Convex_hull_3/dependencies @@ -24,5 +24,4 @@ Random_numbers STL_Extension Stream_support TDS_2 -Triangulation_2 Triangulation_3 diff --git a/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp b/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp index c006f0586e5..731e0d7fd1b 100644 --- a/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp @@ -152,9 +152,6 @@ void test_collinear() } -#include - - int main() { std::vector points;