Fixed regular cell bases so they actually model the concept

Also, they should not use Bare_point / Weighted_point types, which are defined
in the triangulation (much later during compilation).
This commit is contained in:
Mael Rouxel-Labbé
2017-05-10 16:35:28 +02:00
parent 9bb70c10d4
commit f2a308d9f1
2 changed files with 12 additions and 22 deletions
@@ -45,10 +45,9 @@ public:
typedef typename Cb::Vertex_handle Vertex_handle;
typedef typename Cb::Cell_handle Cell_handle;
typedef GT Geom_traits;
typedef typename Geom_traits::Point_3 Bare_point;
typedef typename Geom_traits::Weighted_point_3 Weighted_point;
typedef typename Geom_traits::Point_3 Point_3;
typedef typename Geom_traits::Weighted_point_3 Point;
typedef C Point_container;
typedef typename Point_container::iterator Point_iterator;
@@ -96,7 +95,7 @@ public:
{ return _hidden.end(); }
template<typename Tag = Memory_policy>
void hide_point(const Weighted_point& p, typename boost::enable_if_c<Tag::value>::type* = NULL)
void hide_point(const Point& p, typename boost::enable_if_c<Tag::value>::type* = NULL)
{ _hidden.push_back(p); }
// Memory_policy is Tag_false ------------------------------------------------
@@ -116,14 +115,13 @@ public:
{ return _hidden.end(); }
template<typename Tag = Memory_policy>
void hide_point(const Weighted_point&, typename boost::disable_if_c<Tag::value>::type* = NULL)
void hide_point(const Point&, typename boost::disable_if_c<Tag::value>::type* = NULL)
{ }
//note this function is not requested by the RegularTriangulationCellBase_3
//it should be replaced everywhere by weighted_circumcenter()
// but remains here for backward compatibility
Bare_point
circumcenter(const Geom_traits& gt = Geom_traits()) const
Point_3 circumcenter(const Geom_traits& gt = Geom_traits()) const
{
return gt.construct_weighted_circumcenter_3_object()
(this->vertex(0)->point(),
@@ -132,8 +130,7 @@ public:
this->vertex(3)->point());
}
Bare_point
weighted_circumcenter(const Geom_traits& gt = Geom_traits()) const
Point_3 weighted_circumcenter(const Geom_traits& gt = Geom_traits()) const
{
return gt.construct_weighted_circumcenter_3_object()
(this->vertex(0)->point(),
@@ -29,7 +29,6 @@
#include <CGAL/basic.h>
#include <CGAL/triangulation_assertions.h>
#include <CGAL/Regular_triangulation_cell_base_3.h>
#include <CGAL/internal/Has_nested_type_Bare_point.h>
#include <boost/mpl/if.hpp>
#include <boost/mpl/identity.hpp>
@@ -40,16 +39,10 @@ template < typename GT, typename Cb = Regular_triangulation_cell_base_3<GT> >
class Regular_triangulation_cell_base_with_weighted_circumcenter_3
: public Cb
{
// 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;
typedef typename GT::Point_3 Point_3;
typedef typename GT::Weighted_point_3 Point;
mutable Bare_point * weighted_circumcenter_;
mutable Point_3* weighted_circumcenter_;
public:
void invalidate_circumcenter()
@@ -81,7 +74,7 @@ public:
(const Regular_triangulation_cell_base_with_weighted_circumcenter_3 &c)
: Cb(c),
weighted_circumcenter_(c.weighted_circumcenter_ != NULL ?
new Bare_point(*(c.weighted_circumcenter_)) :
new Point_3(*(c.weighted_circumcenter_)) :
NULL)
{}
@@ -133,12 +126,12 @@ public:
Cb::set_vertices(v0, v1, v2, v3);
}
const Bare_point &
const Point_3 &
weighted_circumcenter(const Geom_traits& gt = Geom_traits()) const
{
if (weighted_circumcenter_ == NULL) {
weighted_circumcenter_
= new Bare_point(this->Cb::weighted_circumcenter(gt));
= new Point_3(this->Cb::weighted_circumcenter(gt));
} else {
CGAL_expensive_assertion(
this->Cb::weighted_circumcenter(gt) == *weighted_circumcenter_);