mirror of https://github.com/CGAL/cgal
Get rid of the slim Triangulation_2 dependency in Convex_hull_3
This commit is contained in:
parent
129f427d93
commit
61d42c3e21
|
|
@ -17,18 +17,19 @@
|
||||||
|
|
||||||
#include <CGAL/license/Convex_hull_3.h>
|
#include <CGAL/license/Convex_hull_3.h>
|
||||||
|
|
||||||
|
#include <CGAL/Triangulation_ds_face_base_2.h>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <CGAL/Triangulation_face_base_2.h>
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
template < typename Info_, typename GT,
|
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
|
class Convex_hull_face_base_2
|
||||||
: public Fb
|
: public Fb
|
||||||
{
|
{
|
||||||
Info_ _info;
|
Info_ _info;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename Fb::Vertex_handle Vertex_handle;
|
typedef typename Fb::Vertex_handle Vertex_handle;
|
||||||
typedef typename Fb::Face_handle Face_handle;
|
typedef typename Fb::Face_handle Face_handle;
|
||||||
|
|
@ -36,6 +37,7 @@ public:
|
||||||
|
|
||||||
typename std::list<Face_handle>::iterator it;
|
typename std::list<Face_handle>::iterator it;
|
||||||
std::list<typename GT::Point_3> points;
|
std::list<typename GT::Point_3> points;
|
||||||
|
|
||||||
template < typename TDS2 >
|
template < typename TDS2 >
|
||||||
struct Rebind_TDS {
|
struct Rebind_TDS {
|
||||||
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
|
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
|
||||||
|
|
@ -46,20 +48,23 @@ public:
|
||||||
: Fb(), _info(0) {}
|
: Fb(), _info(0) {}
|
||||||
|
|
||||||
Convex_hull_face_base_2(Vertex_handle v0,
|
Convex_hull_face_base_2(Vertex_handle v0,
|
||||||
Vertex_handle v1,
|
Vertex_handle v1,
|
||||||
Vertex_handle v2)
|
Vertex_handle v2)
|
||||||
: Fb(v0, v1, v2), _info(0) {}
|
: Fb(v0, v1, v2), _info(0) {}
|
||||||
|
|
||||||
Convex_hull_face_base_2(Vertex_handle v0,
|
Convex_hull_face_base_2(Vertex_handle v0,
|
||||||
Vertex_handle v1,
|
Vertex_handle v1,
|
||||||
Vertex_handle v2,
|
Vertex_handle v2,
|
||||||
Face_handle n0,
|
Face_handle n0,
|
||||||
Face_handle n1,
|
Face_handle n1,
|
||||||
Face_handle n2 )
|
Face_handle n2 )
|
||||||
: Fb(v0, v1, v2, n0, n1, n2), _info(0) {}
|
: Fb(v0, v1, v2, n0, n1, n2), _info(0) {}
|
||||||
|
|
||||||
const Info& info() const { return _info; }
|
const Info& info() const { return _info; }
|
||||||
Info& info() { 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
|
} //namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,16 @@
|
||||||
|
|
||||||
#include <CGAL/license/Convex_hull_3.h>
|
#include <CGAL/license/Convex_hull_3.h>
|
||||||
|
|
||||||
|
|
||||||
#include <CGAL/Polyhedron_3_fwd.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_xy_3.h>
|
||||||
#include <CGAL/Projection_traits_xz_3.h>
|
#include <CGAL/Projection_traits_xz_3.h>
|
||||||
#include <CGAL/Projection_traits_yz_3.h>
|
#include <CGAL/Projection_traits_yz_3.h>
|
||||||
#include <list>
|
|
||||||
#include <CGAL/Filtered_predicate.h>
|
#include <CGAL/Filtered_predicate.h>
|
||||||
#include <CGAL/Cartesian_converter.h>
|
#include <CGAL/Cartesian_converter.h>
|
||||||
#include <CGAL/Default.h>
|
#include <CGAL/Default.h>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
template < class R_ >
|
template < class R_ >
|
||||||
class Point_triple
|
class Point_triple
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -17,18 +17,16 @@
|
||||||
|
|
||||||
#include <CGAL/license/Convex_hull_3.h>
|
#include <CGAL/license/Convex_hull_3.h>
|
||||||
|
|
||||||
#include <CGAL/disable_warnings.h>
|
|
||||||
|
|
||||||
#include <CGAL/basic.h>
|
|
||||||
#include <CGAL/algorithm.h>
|
#include <CGAL/algorithm.h>
|
||||||
#include <CGAL/convex_hull_2.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_xy_3.h>
|
||||||
#include <CGAL/Projection_traits_xz_3.h>
|
#include <CGAL/Projection_traits_xz_3.h>
|
||||||
#include <CGAL/Projection_traits_yz_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_data_structure_2.h>
|
||||||
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
|
|
||||||
#include <CGAL/Cartesian_converter.h>
|
#include <CGAL/Cartesian_converter.h>
|
||||||
#include <CGAL/Simple_cartesian.h>
|
#include <CGAL/Simple_cartesian.h>
|
||||||
|
|
||||||
|
|
@ -772,15 +770,15 @@ ch_quickhull_face_graph(std::list<typename Traits::Point_3>& points,
|
||||||
const Traits& traits)
|
const Traits& traits)
|
||||||
{
|
{
|
||||||
typedef typename Traits::Point_3 Point_3;
|
typedef typename Traits::Point_3 Point_3;
|
||||||
typedef typename Traits::Plane_3 Plane_3;
|
typedef typename Traits::Plane_3 Plane_3;
|
||||||
typedef typename std::list<Point_3>::iterator P3_iterator;
|
typedef typename std::list<Point_3>::iterator P3_iterator;
|
||||||
|
|
||||||
typedef Triangulation_data_structure_2<
|
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;
|
Convex_hull_face_base_2<int, Traits> > Tds;
|
||||||
|
|
||||||
typedef typename Tds::Vertex_handle Vertex_handle;
|
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||||
typedef typename Tds::Face_handle Face_handle;
|
typedef typename Tds::Face_handle Face_handle;
|
||||||
|
|
||||||
// found three points that are not collinear, so construct the plane defined
|
// 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
|
// 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
|
} // namespace CGAL
|
||||||
|
|
||||||
#include <CGAL/enable_warnings.h>
|
|
||||||
|
|
||||||
#endif // CGAL_CONVEX_HULL_3_H
|
#endif // CGAL_CONVEX_HULL_3_H
|
||||||
|
|
|
||||||
|
|
@ -24,5 +24,4 @@ Random_numbers
|
||||||
STL_Extension
|
STL_Extension
|
||||||
Stream_support
|
Stream_support
|
||||||
TDS_2
|
TDS_2
|
||||||
Triangulation_2
|
|
||||||
Triangulation_3
|
Triangulation_3
|
||||||
|
|
|
||||||
|
|
@ -152,9 +152,6 @@ void test_collinear()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <CGAL/Triangulation_face_base_with_info_2.h>
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::vector<Point_3> points;
|
std::vector<Point_3> points;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue