mirror of https://github.com/CGAL/cgal
really use the GT given as a parameter
When the geom_traits given as parameter of `circumcenter` and/or `weighted_circumcenter` was deriving from the cell base GT (first template parameter), the gt was up-casted to the cell base GT, and the function construct_circumcenter_3_object() (or construct_weighted_circumcenter_3_object()) not called on the right geom traits type --> possibly missing the actual input of the function (the robust_circumcenter_traits in Mesh_3) we add a static assert to check at compile time that both geom traits are compatible
This commit is contained in:
parent
ecd7bbdc3e
commit
c37857bd9e
|
|
@ -38,6 +38,9 @@
|
|||
#include <CGAL/Regular_triangulation_cell_base_3.h>
|
||||
#include <CGAL/Mesh_3/io_signature.h>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/is_same.hpp>
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
# include <tbb/atomic.h>
|
||||
#endif
|
||||
|
|
@ -474,9 +477,18 @@ public:
|
|||
V[3] = v3;
|
||||
}
|
||||
|
||||
const Bare_point &
|
||||
weighted_circumcenter(const Geom_traits& gt = Geom_traits()) const
|
||||
template<typename GT_>
|
||||
const Bare_point& weighted_circumcenter(const GT_& gt) const
|
||||
{
|
||||
std::cout << "Point : " << typeid(Bare_point).name() << std::endl;
|
||||
std::cout << "GT_ : " << typeid(GT_).name() << std::endl;
|
||||
std::cout << "GT_::Construct_weighted_circumcenter_3 : "
|
||||
<< typeid(GT_::Construct_weighted_circumcenter_3).name() << std::endl;
|
||||
std::cout << "result_type : " << typeid(GT_::Construct_weighted_circumcenter_3::result_type).name() << std::endl;
|
||||
|
||||
//BOOST_STATIC_ASSERT(boost::is_same<Bare_point,
|
||||
// typename GT_::Construct_weighted_circumcenter_3::result_type>::value);
|
||||
|
||||
if (circumcenter_ == NULL) {
|
||||
this->try_to_set_circumcenter(
|
||||
new Bare_point(gt.construct_weighted_circumcenter_3_object()
|
||||
|
|
@ -494,6 +506,10 @@ public:
|
|||
return *circumcenter_;
|
||||
}
|
||||
|
||||
const Bare_point & weighted_circumcenter() const
|
||||
{
|
||||
return weighted_circumcenter(Geom_traits());
|
||||
}
|
||||
|
||||
// Returns the index of the cell of the input complex that contains the cell
|
||||
Subdomain_index subdomain_index() const { return subdomain_index_; }
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
#include <CGAL/Triangulation_ds_cell_base_3.h>
|
||||
#include <CGAL/Triangulation_cell_base_3.h>
|
||||
|
||||
#include <boost/core/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < typename GT, typename Cb = Triangulation_ds_cell_base_3<> >
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
|
||||
#include <list>
|
||||
|
||||
#include <boost/core/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < typename GT,
|
||||
|
|
@ -121,8 +124,11 @@ public:
|
|||
//note this function is not requested by the RegularTriangulationCellBase_3
|
||||
//it should be replaced everywhere by weighted_circumcenter()
|
||||
// but remains here for backward compatibility
|
||||
Point_3 circumcenter(const Geom_traits& gt = Geom_traits()) const
|
||||
template<typename GT_>
|
||||
Point_3 circumcenter(const GT_& gt) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT(boost::is_same<Point_3,
|
||||
typename GT_::Construct_weighted_circumcenter_3::result_type>::value);
|
||||
return gt.construct_weighted_circumcenter_3_object()
|
||||
(this->vertex(0)->point(),
|
||||
this->vertex(1)->point(),
|
||||
|
|
@ -130,8 +136,16 @@ public:
|
|||
this->vertex(3)->point());
|
||||
}
|
||||
|
||||
Point_3 weighted_circumcenter(const Geom_traits& gt = Geom_traits()) const
|
||||
Point_3 circumcenter() const
|
||||
{
|
||||
return circumcenter(Geom_traits());
|
||||
}
|
||||
|
||||
template<typename GT_>
|
||||
Point_3 weighted_circumcenter(const GT_& gt) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT(boost::is_same<Point_3,
|
||||
typename GT_::Construct_weighted_circumcenter_3::result_type>::value);
|
||||
return gt.construct_weighted_circumcenter_3_object()
|
||||
(this->vertex(0)->point(),
|
||||
this->vertex(1)->point(),
|
||||
|
|
@ -139,6 +153,11 @@ public:
|
|||
this->vertex(3)->point());
|
||||
}
|
||||
|
||||
Point_3 weighted_circumcenter() const
|
||||
{
|
||||
return weighted_circumcenter(Geom_traits());
|
||||
}
|
||||
|
||||
private:
|
||||
Point_container _hidden;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue