Get rid of the slim Triangulation_2 dependency in Convex_hull_3

This commit is contained in:
Mael Rouxel-Labbé 2021-12-16 13:49:45 +01:00
parent 129f427d93
commit 61d42c3e21
6 changed files with 111 additions and 30 deletions

View File

@ -17,18 +17,19 @@
#include <CGAL/license/Convex_hull_3.h>
#include <CGAL/Triangulation_ds_face_base_2.h>
#include <list>
#include <CGAL/Triangulation_face_base_2.h>
namespace CGAL {
template < typename Info_, typename GT,
typename Fb = Triangulation_face_base_2<GT> >
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<Face_handle>::iterator it;
std::list<typename GT::Point_3> points;
template < typename TDS2 >
struct Rebind_TDS {
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
@ -60,6 +62,9 @@ public:
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

View File

@ -15,18 +15,16 @@
#include <CGAL/license/Convex_hull_3.h>
#include <CGAL/Polyhedron_3_fwd.h>
#include <CGAL/Convex_hull_face_base_2.h>
#include <CGAL/Projection_traits_xy_3.h>
#include <CGAL/Projection_traits_xz_3.h>
#include <CGAL/Projection_traits_yz_3.h>
#include <list>
#include <CGAL/Filtered_predicate.h>
#include <CGAL/Cartesian_converter.h>
#include <CGAL/Default.h>
namespace CGAL {
template < class R_ >
class Point_triple
{

View File

@ -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 <CGAL/license/Convex_hull_3.h>
#include <CGAL/Triangulation_ds_vertex_base_2.h>
#include <list>
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<TDS2>::Other Vb2;
typedef Convex_hull_vertex_base_2<Info, GT, Vb2> 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 <typename GT, typename Vb>
std::istream&
operator>>(std::istream &is, Convex_hull_vertex_base_2<GT, Vb>& v)
{
return is >> static_cast<Vb&>(v) >> v.point();
}
template <typename GT, typename Vb>
std::ostream&
operator<<(std::ostream &os, const Convex_hull_vertex_base_2<GT, Vb>& v)
{
return os << static_cast<const Vb&>(v) << v.point();
}
} //namespace CGAL
#endif // CGAL_CONVEX_HULL_VERTEX_BASE_2_H

View File

@ -17,18 +17,16 @@
#include <CGAL/license/Convex_hull_3.h>
#include <CGAL/disable_warnings.h>
#include <CGAL/basic.h>
#include <CGAL/algorithm.h>
#include <CGAL/convex_hull_2.h>
#include <CGAL/Convex_hull_traits_3.h>
#include <CGAL/Convex_hull_2/ch_assertions.h>
#include <CGAL/Convex_hull_face_base_2.h>
#include <CGAL/Convex_hull_vertex_base_2.h>
#include <CGAL/Projection_traits_xy_3.h>
#include <CGAL/Projection_traits_xz_3.h>
#include <CGAL/Projection_traits_yz_3.h>
#include <CGAL/Convex_hull_traits_3.h>
#include <CGAL/Convex_hull_2/ch_assertions.h>
#include <CGAL/Triangulation_data_structure_2.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Cartesian_converter.h>
#include <CGAL/Simple_cartesian.h>
@ -776,7 +774,7 @@ ch_quickhull_face_graph(std::list<typename Traits::Point_3>& points,
typedef typename std::list<Point_3>::iterator P3_iterator;
typedef Triangulation_data_structure_2<
Triangulation_vertex_base_with_info_2<int, GT3_for_CH3<Traits> >,
Convex_hull_vertex_base_2<int, GT3_for_CH3<Traits> >,
Convex_hull_face_base_2<int, Traits> > Tds;
typedef typename Tds::Vertex_handle Vertex_handle;
@ -1111,6 +1109,4 @@ extreme_points_3(const InputRange& range, OutputIterator out)
} // namespace CGAL
#include <CGAL/enable_warnings.h>
#endif // CGAL_CONVEX_HULL_3_H

View File

@ -24,5 +24,4 @@ Random_numbers
STL_Extension
Stream_support
TDS_2
Triangulation_2
Triangulation_3

View File

@ -152,9 +152,6 @@ void test_collinear()
}
#include <CGAL/Triangulation_face_base_with_info_2.h>
int main()
{
std::vector<Point_3> points;