Fixed Bare_point / Weighted_point usage in Triangulation_2

This commit is contained in:
Mael Rouxel-Labbé 2017-04-14 16:53:18 +02:00
parent 729c054871
commit ef262c9d24
4 changed files with 31 additions and 25 deletions

View File

@ -27,9 +27,7 @@
#include <CGAL/license/Triangulation_2.h>
#include <CGAL/internal/Triangulation/Has_nested_type_Bare_point.h>
#include <boost/mpl/if.hpp>
#include <boost/mpl/identity.hpp>
namespace CGAL {
@ -43,19 +41,12 @@ class Regular_traits_adaptor_2
typedef Functor_ Functor;
typedef typename RTraits::FT FT;
#if 0
typedef typename boost::mpl::eval_if_c<
internal::Has_nested_type_Bare_point<RTraits>::value,
typename internal::Bare_point_type<RTraits>,
boost::mpl::identity<typename RTraits::Point_2>
>::type Point_2;
#else
typedef typename RTT::Point_2 Point_2;
#endif
typedef typename RTraits::Triangle_2 Triangle_2;
typedef typename RTraits::Segment_2 Segment_2;
typedef typename RTraits::Triangle_2 Triangle_2;
typedef typename RTraits::Segment_2 Segment_2;
typedef typename RTraits::Circle_2 Circle_2;
typedef typename RTraits::Weighted_point_2 Weighted_point_2;
typedef typename RTT::Point_2 Point_2;
typedef typename RTT::Weighted_point_2 Weighted_point_2;
template <class T>
struct Conv_wp_to_p

View File

@ -191,12 +191,16 @@ public:
typedef Self Triangulation;
typedef Tds Triangulation_data_structure;
typedef internal::RegTraits_2<Gt> Geom_traits;
// Traits are not supposed to define Bare_point, but leaving below
// for backward compatibility
typedef typename boost::mpl::eval_if_c<
internal::Has_nested_type_Bare_point<Gt>::value,
typename internal::Bare_point_type<Gt>,
boost::mpl::identity<typename Gt::Point_2>
>::type Bare_point;
typedef typename Gt::Weighted_point_2 Weighted_point;
typedef typename Gt::FT Weight;
typedef typename Gt::Construct_weighted_point_2 Construct_weighted_point_2;
typedef typename Base::size_type size_type;

View File

@ -26,12 +26,15 @@
#include <CGAL/basic.h>
#include <CGAL/internal/Triangulation/Has_nested_type_Bare_point.h>
#include <CGAL/Triangulation_hierarchy_vertex_base_2.h>
#include <CGAL/triangulation_assertions.h>
#include <CGAL/spatial_sort.h>
#include <map>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
#include <boost/random/linear_congruential.hpp>
#include <boost/random/geometric_distribution.hpp>
#include <boost/random/variate_generator.hpp>
@ -52,20 +55,25 @@ class Triangulation_hierarchy_2
public:
typedef Tr_ Tr_Base;
typedef typename Tr_Base::Geom_traits Geom_traits;
typedef typename Tr_Base::Point Point; // this one may be weighted or not
typedef typename Tr_Base::size_type size_type;
typedef typename Tr_Base::Vertex_handle Vertex_handle;
typedef typename Tr_Base::Face_handle Face_handle;
typedef typename Tr_Base::Vertex Vertex;
typedef typename Tr_Base::Locate_type Locate_type;
typedef typename Tr_Base::Finite_vertices_iterator Finite_vertices_iterator;
//typedef typename Tr_Base::Finite_faces_iterator Finite_faces_iterator;
typedef typename Geom_traits::Point_2 Bare_point;
typedef typename Geom_traits::Weighted_point_2 Weighted_point;
// this one may be weighted or not
typedef typename Tr_Base::Point Point;
typedef typename Tr_Base::Weighted_tag Weighted_tag;
// If the triangulation has defined the `Bare_point` typename, use it.
typedef typename boost::mpl::eval_if_c<
internal::Has_nested_type_Bare_point<Tr_Base>::value,
typename internal::Bare_point_type<Tr_Base>,
boost::mpl::identity<typename Tr_Base::Point>
>::type Bare_point;
typedef typename Geom_traits::Weighted_point_2 Weighted_point;
typedef typename Tr_Base::Weighted_tag Weighted_tag;
#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
using Tr_Base::geom_traits;

View File

@ -41,13 +41,16 @@ _test_regular_duality( const Del &T );
template < class Triangulation, class Point, class Face_handle >
bool
_test_is_to_the_left( const Triangulation &T,
const Point &p,
const Face_handle &f,
const int li)
const Point &p,
const Face_handle &f,
const int li)
{
typename Triangulation::Geom_traits::Construct_weighted_point_2 p2wp =
T.geom_traits().construct_weighted_point_2_object();
return( T.orientation(f->vertex(f->ccw(li))->point(),
f->vertex(f->cw(li))->point(),
typename Triangulation::Weighted_point(p)) == CGAL::LEFT_TURN );
f->vertex(f->cw(li))->point(),
p2wp(p)) == CGAL::LEFT_TURN );
}
template <class Triangulation>