Fixed usage of Bare point and Weighted point across Triangulation_3

This commit is contained in:
Mael Rouxel-Labbé 2017-04-14 16:48:31 +02:00
parent f67d75e0df
commit 5856c7de2b
8 changed files with 44 additions and 37 deletions

View File

@ -29,7 +29,7 @@ public:
/// \name Types
/// @{
typedef RegularTriangulationTraits_3::Bare_point Bare_point;
typedef RegularTriangulationTraits_3::Point_3 Bare_point;
/// @}
/*! \name Access function
@ -48,7 +48,7 @@ Note that this point has no weight.
/// @{
/*!
Returns the weighted circumcenter of the cell.
Be careful that the return type is `RegularTriangulationTraits_3::Bare_point`,
Be careful that the return type is `Bare_point`,
and the radius of the weighted
circumcenter is not supposed to be computed
by the constructor `Construct_weighted_circumcenter_3` of the traits

View File

@ -33,7 +33,7 @@ public:
/// \name Types
/// @{
typedef RegularTriangulationTraits_3::Bare_point Bare_point;
typedef RegularTriangulationTraits_3::Point_3 Bare_point;
/// @}
/*! \name Access function

View File

@ -10,7 +10,6 @@ int main()
{
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point;
// Regular T3
typedef CGAL::Triangulation_data_structure_3<
@ -19,17 +18,20 @@ int main()
CGAL::Parallel_tag> Tds;
typedef CGAL::Regular_triangulation_3<K, Tds> Rt;
typedef Rt::Bare_point Bare_point;
typedef Rt::Weighted_point Weighted_point;
typedef Rt::Vertex_handle Vertex_handle;
const int NUM_INSERTED_POINTS = 5000;
CGAL::Random_points_in_cube_3<Point> rnd(1.);
CGAL::Random_points_in_cube_3<Bare_point> rnd(1.);
// Construction from a vector of 1,000,000 points
std::vector<Point> V;
std::vector<Weighted_point> V;
V.reserve(NUM_INSERTED_POINTS);
for (int i = 0; i != NUM_INSERTED_POINTS; ++i)
V.push_back(*rnd++);
V.push_back(Weighted_point(*rnd++));
// Construct the locking data-structure, using the bounding-box of the points
Rt::Lock_data_structure locking_ds(

View File

@ -27,9 +27,7 @@
#include <CGAL/license/Triangulation_3.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,13 @@ class Regular_traits_adaptor
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_3>
>::type Point_3;
#else
typedef typename RTT::Point_3 Point_3;
#endif
typedef typename RTraits::Tetrahedron_3 Tetrahedron_3;
typedef typename RTraits::Plane_3 Plane_3;
typedef typename RTraits::Tetrahedron_3 Tetrahedron_3;
typedef typename RTraits::Plane_3 Plane_3;
typedef typename RTraits::Sphere_3 Sphere_3;
typedef typename RTraits::Weighted_point_3 Weighted_point_3;
typedef typename RTT::Point_3 Point_3;
typedef typename RTT::Weighted_point_3 Weighted_point_3;
template <class T>
struct Conv_wp_to_p

View File

@ -366,12 +366,14 @@ namespace CGAL {
typedef typename Tr_Base::Finite_edges_iterator Finite_edges_iterator;
typedef typename Tr_Base::All_cells_iterator All_cells_iterator;
typedef typename Gt::Weighted_point_3 Weighted_point;
// 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_3>
>::type Bare_point;
typedef typename Gt::Weighted_point_3 Weighted_point;
typedef typename Gt::Segment_3 Segment;
typedef typename Gt::Triangle_3 Triangle;
@ -2240,7 +2242,8 @@ dual(Cell_handle c) const
Regular_triangulation_3<Gt,Tds,Lds>::
is_Gabriel(Vertex_handle v) const
{
return nearest_power_vertex( v->point().point(), v->cell()) == v;
return nearest_power_vertex(
geom_traits().construct_point_3_object()(v->point()), v->cell()) == v;
}
// Returns

View File

@ -44,7 +44,8 @@ public:
typedef GT Geom_traits;
typedef typename Geom_traits::Weighted_point_3 Point;
typedef typename Geom_traits::Point_3 Bare_point;
typedef typename Geom_traits::Weighted_point_3 Weighted_point;
typedef C Point_container;
typedef typename Point_container::iterator Point_iterator;
@ -81,13 +82,13 @@ public:
Point_const_iterator hidden_points_begin() const { return _hidden.begin(); }
Point_const_iterator hidden_points_end() const { return _hidden.end(); }
void hide_point (const Point &p) { _hidden.push_back(p); }
void hide_point (const Weighted_point &p) { _hidden.push_back(p); }
// void unhide_point (Point_iterator i) { _hidden.delete(i); }
//note this function is not requested by the RegularTriangulationCellBase_3
//it should be replaced everywhere by weighted_circumcenter()
// but remains here for backward compatibility
typename Geom_traits::Point_3
Bare_point
circumcenter(const Geom_traits& gt = Geom_traits()) const
{
return gt.construct_weighted_circumcenter_3_object()
@ -97,7 +98,7 @@ public:
this->vertex(3)->point());
}
typename Geom_traits::Point_3
Bare_point
weighted_circumcenter(const Geom_traits& gt = Geom_traits()) const
{
return gt.construct_weighted_circumcenter_3_object()

View File

@ -26,10 +26,13 @@
#include <CGAL/license/Triangulation_3.h>
#include <CGAL/basic.h>
#include <CGAL/triangulation_assertions.h>
#include <CGAL/Regular_triangulation_cell_base_3.h>
#include <CGAL/internal/Triangulation/Has_nested_type_Bare_point.h>
#include <boost/mpl/if.hpp>
#include <boost/mpl/identity.hpp>
namespace CGAL {
@ -37,8 +40,14 @@ template < typename GT, typename Cb = Regular_triangulation_cell_base_3<GT> >
class Regular_triangulation_cell_base_with_weighted_circumcenter_3
: public Cb
{
typedef typename GT::Point_3 Point_3;
typedef typename GT::Bare_point Bare_point;
// Traits are not supposed to define Bare_point, but leaving this
// for backward compatibility since GT::Point_3 could be a K::Weighted_point_3
// in older traits
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_3>
>::type Bare_point;
mutable Bare_point * weighted_circumcenter_;

View File

@ -28,17 +28,17 @@ template <class Triangulation>
void
_test_cls_regular_3(const Triangulation &)
{
typedef Triangulation Cls;
typedef typename Triangulation::Traits Tr;
CGAL_USE_TYPE(Tr);
typedef Triangulation Cls;
typedef typename Triangulation::Geom_traits Gt;
CGAL_USE_TYPE(Gt);
typedef typename Triangulation::Bare_point Bare_point;
// We assume the traits class has been tested already
// actually, any traits is good if it has been tested
// typedef typename Cls::Bare_point Point;
typedef typename Cls::Weighted_point Weighted_point;
typedef std::list<Weighted_point> list_point;
typedef typename Cls::Bare_point Bare_point;
typedef typename Cls::Weighted_point Weighted_point;
typedef std::list<Weighted_point> list_point;
// temporary version