mirror of https://github.com/CGAL/cgal
- First part of introduction of Return_base_tag workaround for lack
of "forwarding constructors".
Quoting some comment in the code:
"
This is a simple tag which is used as additional (first) argument in
some kernel functors, to tell them to return the base (rep) class,
instead of the main type (e.g. Kernel_base::Point_2 instead
of Kernel::Point_2). This is a minor optimization which prevents
useless copies of the "reps".
Those functors are only those used in the constructors of the kernel
types like Point_2, so it's limited.
The real solution will be to use "forwarding constructors", when they
will be available in C++.
In the mean time, this should be a mostly/hopefully internal hack.
"
This commit is contained in:
parent
12dbb148a9
commit
2eb12d7441
|
|
@ -1890,36 +1890,66 @@ namespace CartesianKernelFunctors {
|
|||
typedef Arity_tag< 1 > Arity;
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(const RT& x, const RT& y) const
|
||||
operator()(Return_base_tag, const RT& x, const RT& y) const
|
||||
{ return Rep(x, y); }
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(const Vector_2& v) const
|
||||
operator()(Return_base_tag, const Vector_2& v) const
|
||||
{
|
||||
return Rep(v.x(),v.y()); }
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(const Line_2& l) const
|
||||
operator()(Return_base_tag, const Line_2& l) const
|
||||
{ return Rep(l.b(), -l.a()); }
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
|
||||
{
|
||||
return Rep(q.x() - p.x(), q.y() - p.y());
|
||||
}
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(Return_base_tag, const Ray_2& r) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), r.source(), r.second_point());
|
||||
}
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(Return_base_tag, const Segment_2& s) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), s.source(), s.target());
|
||||
}
|
||||
|
||||
|
||||
Direction_2
|
||||
operator()(const RT& x, const RT& y) const
|
||||
{ return this->operator()(Return_base_tag(), x, y); }
|
||||
|
||||
Direction_2
|
||||
operator()(const Vector_2& v) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), v); }
|
||||
|
||||
Direction_2
|
||||
operator()(const Line_2& l) const
|
||||
{ return this->operator()(Return_base_tag(), l); }
|
||||
|
||||
Direction_2
|
||||
operator()(const Point_2& p, const Point_2& q) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), p, q);
|
||||
}
|
||||
|
||||
Direction_2
|
||||
operator()(const Ray_2& r) const
|
||||
{
|
||||
typename K::Construct_direction_2 construct_direction;
|
||||
return construct_direction(r.source(), r.second_point());
|
||||
return this->operator()(Return_base_tag(), r);
|
||||
}
|
||||
|
||||
Direction_2
|
||||
operator()(const Segment_2& s) const
|
||||
{
|
||||
typename K::Construct_direction_2 construct_direction;
|
||||
return construct_direction( s.source(), s.target());
|
||||
}
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(const Point_2& p, const Point_2& q) const
|
||||
{
|
||||
return Rep(q.x() - p.x(), q.y() - p.y());
|
||||
return this->operator()(Return_base_tag(), s);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1937,27 +1967,46 @@ namespace CartesianKernelFunctors {
|
|||
typedef Direction_3 result_type;
|
||||
typedef Arity_tag< 1 > Arity;
|
||||
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
Rep // Direction_3
|
||||
operator()(const RT& x, const RT& y, const RT& z) const
|
||||
operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const
|
||||
{ return Rep(x, y, z); }
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
Rep // Direction_3
|
||||
operator()(const Vector_3& v) const
|
||||
operator()(Return_base_tag, const Vector_3& v) const
|
||||
{ return Rep(v); }
|
||||
|
||||
Rep // Direction_3
|
||||
operator()(const Line_3& l) const
|
||||
operator()(Return_base_tag, const Line_3& l) const
|
||||
{ return Rep(l); }
|
||||
|
||||
Rep // Direction_3
|
||||
operator()(const Ray_3& r) const
|
||||
operator()(Return_base_tag, const Ray_3& r) const
|
||||
{ return Rep(r); }
|
||||
|
||||
Rep // Direction_3
|
||||
operator()(const Segment_3& s) const
|
||||
operator()(Return_base_tag, const Segment_3& s) const
|
||||
{ return Rep(s); }
|
||||
|
||||
|
||||
Direction_3
|
||||
operator()(const RT& x, const RT& y, const RT& z) const
|
||||
{ return this->operator()(Return_base_tag(), x, y, z); }
|
||||
|
||||
Direction_3
|
||||
operator()(const Vector_3& v) const
|
||||
{ return this->operator()(Return_base_tag(), v); }
|
||||
|
||||
Direction_3
|
||||
operator()(const Line_3& l) const
|
||||
{ return this->operator()(Return_base_tag(), l); }
|
||||
|
||||
Direction_3
|
||||
operator()(const Ray_3& r) const
|
||||
{ return this->operator()(Return_base_tag(), r); }
|
||||
|
||||
Direction_3
|
||||
operator()(const Segment_3& s) const
|
||||
{ return this->operator()(Return_base_tag(), s); }
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
|
|
@ -2038,7 +2087,7 @@ namespace CartesianKernelFunctors {
|
|||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
Rep // Iso_rectangle_2
|
||||
operator()(const Point_2& p, const Point_2& q, int) const
|
||||
operator()(Return_base_tag, const Point_2& p, const Point_2& q, int) const
|
||||
{
|
||||
// I have to remove the assertions, because of Cartesian_converter.
|
||||
// CGAL_kernel_assertion(p.x()<=q.x());
|
||||
|
|
@ -2047,7 +2096,7 @@ namespace CartesianKernelFunctors {
|
|||
}
|
||||
|
||||
Rep // Iso_rectangle_2
|
||||
operator()(const Point_2& p, const Point_2& q) const
|
||||
operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
|
||||
{
|
||||
FT minx, maxx, miny, maxy;
|
||||
if (p.x() < q.x()) { minx = p.x(); maxx = q.x(); }
|
||||
|
|
@ -2060,7 +2109,7 @@ namespace CartesianKernelFunctors {
|
|||
}
|
||||
|
||||
Rep // Iso_rectangle_2
|
||||
operator()(const Point_2 &left, const Point_2 &right,
|
||||
operator()(Return_base_tag, const Point_2 &left, const Point_2 &right,
|
||||
const Point_2 &bottom, const Point_2 &top) const
|
||||
{
|
||||
CGAL_kernel_assertion_code(typename K::Less_x_2 less_x;)
|
||||
|
|
@ -2072,7 +2121,7 @@ namespace CartesianKernelFunctors {
|
|||
}
|
||||
|
||||
Rep // Iso_rectangle_2
|
||||
operator()(const RT& min_hx, const RT& min_hy,
|
||||
operator()(Return_base_tag, const RT& min_hx, const RT& min_hy,
|
||||
const RT& max_hx, const RT& max_hy) const
|
||||
{
|
||||
CGAL_kernel_precondition(min_hx <= max_hx);
|
||||
|
|
@ -2082,7 +2131,7 @@ namespace CartesianKernelFunctors {
|
|||
}
|
||||
|
||||
Rep // Iso_rectangle_2
|
||||
operator()(const RT& min_hx, const RT& min_hy,
|
||||
operator()(Return_base_tag, const RT& min_hx, const RT& min_hy,
|
||||
const RT& max_hx, const RT& max_hy, const RT& hw) const
|
||||
{
|
||||
if (hw == 1)
|
||||
|
|
@ -2091,6 +2140,40 @@ namespace CartesianKernelFunctors {
|
|||
return Rep(Point_2(min_hx/hw, min_hy/hw),
|
||||
Point_2(max_hx/hw, max_hy/hw), 0);
|
||||
}
|
||||
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const Point_2& p, const Point_2& q, int i) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), p, q, i);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const Point_2& p, const Point_2& q) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), p, q);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const Point_2 &left, const Point_2 &right,
|
||||
const Point_2 &bottom, const Point_2 &top) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), left, right, bottom, top);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const RT& min_hx, const RT& min_hy,
|
||||
const RT& max_hx, const RT& max_hy) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const RT& min_hx, const RT& min_hy,
|
||||
const RT& max_hx, const RT& max_hy, const RT& hw) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy, hw);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <CGAL/Lazy_exact_nt.h>
|
||||
#include <CGAL/Kernel/Type_mapper.h>
|
||||
#include <CGAL/Profile_counter.h>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -57,6 +58,13 @@ approx(const Lazy_exact_nt<ET>& l)
|
|||
return l.approx();
|
||||
}
|
||||
|
||||
inline
|
||||
const Return_base_tag &
|
||||
approx(const Return_base_tag& d)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
inline
|
||||
const double&
|
||||
approx(const double& d)
|
||||
|
|
@ -99,6 +107,13 @@ exact(const Null_vector& nv)
|
|||
return nv;
|
||||
}
|
||||
|
||||
inline
|
||||
const Return_base_tag &
|
||||
exact(const Return_base_tag& d)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
inline
|
||||
const Origin&
|
||||
approx(const Origin& nv)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <CGAL/Kernel/function_objects.h>
|
||||
#include <CGAL/Cartesian/function_objects.h>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -2372,31 +2373,58 @@ namespace HomogeneousKernelFunctors {
|
|||
typedef Direction_2 result_type;
|
||||
typedef Arity_tag< 1 > Arity;
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(Return_base_tag, const RT& x, const RT& y) const
|
||||
{ return Rep(x, y); }
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(Return_base_tag, const Vector_2& v) const
|
||||
{ return Rep(v.hx(),v.hy()); }
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(Return_base_tag, const Line_2& l) const
|
||||
{ return Rep(l.b(), -l.a()); }
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(Return_base_tag, const Ray_2& r) const
|
||||
{ return this->operator()(Return_base_tag(), r.source(), r.second_point()); }
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(Return_base_tag, const Segment_2& s) const
|
||||
{ return this->operator()(Return_base_tag(), s.source(), s.target()); }
|
||||
|
||||
Rep // Direction_2
|
||||
operator()(Return_base_tag, const Point_2& q, const Point_2& p) const
|
||||
{
|
||||
return Rep( p.hx()*q.hw() - q.hx()*p.hw(),
|
||||
p.hy()*q.hw() - q.hy()*p.hw() );
|
||||
}
|
||||
|
||||
|
||||
Direction_2
|
||||
operator()(const RT& x, const RT& y) const
|
||||
{ return Rep(x, y); }
|
||||
{ return this->operator()(Return_base_tag(), x, y); }
|
||||
|
||||
Direction_2
|
||||
operator()(const Vector_2& v) const
|
||||
{ return Rep(v.hx(),v.hy()); }
|
||||
{ return this->operator()(Return_base_tag(), v); }
|
||||
|
||||
Direction_2
|
||||
operator()(const Line_2& l) const
|
||||
{ return Rep(l.b(), -l.a()); }
|
||||
{ return this->operator()(Return_base_tag(), l); }
|
||||
|
||||
Direction_2
|
||||
operator()(const Ray_2& r) const
|
||||
{ return K().construct_direction_2_object()(r.source(), r.second_point()); }
|
||||
{ return this->operator()(Return_base_tag(), r); }
|
||||
|
||||
Direction_2
|
||||
operator()(const Segment_2& s) const
|
||||
{ return K().construct_direction_2_object()(s.source(), s.target()); }
|
||||
{ return this->operator()(Return_base_tag(), s); }
|
||||
|
||||
Direction_2
|
||||
operator()(const Point_2& q, const Point_2& p) const
|
||||
{
|
||||
return Rep( p.hx()*q.hw() - q.hx()*p.hw(),
|
||||
p.hy()*q.hw() - q.hy()*p.hw() );
|
||||
return this->operator()(Return_base_tag(), p, q);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -2414,27 +2442,46 @@ namespace HomogeneousKernelFunctors {
|
|||
typedef Direction_3 result_type;
|
||||
typedef Arity_tag< 1 > Arity;
|
||||
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
Rep // Direction_3
|
||||
operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const
|
||||
{ return Rep(x, y, z); }
|
||||
|
||||
Rep // Direction_3
|
||||
operator()(Return_base_tag, const Vector_3& v) const
|
||||
{ return Rep(v.hx(), v.hy(), v.hz()); }
|
||||
|
||||
Rep // Direction_3
|
||||
operator()(Return_base_tag, const Line_3& l) const
|
||||
{ return Rep(l); }
|
||||
|
||||
Rep // Direction_3
|
||||
operator()(Return_base_tag, const Ray_3& r) const
|
||||
{ return Rep(r); }
|
||||
|
||||
Rep // Direction_3
|
||||
operator()(Return_base_tag, const Segment_3& s) const
|
||||
{ return Rep(s); }
|
||||
|
||||
|
||||
Direction_3
|
||||
operator()(const RT& x, const RT& y, const RT& z) const
|
||||
{ return Rep(x, y, z); }
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
{ return this->operator()(Return_base_tag(), x, y, z); }
|
||||
|
||||
Direction_3
|
||||
operator()(const Vector_3& v) const
|
||||
{ return Rep(v.hx(), v.hy(), v.hz()); }
|
||||
{ return this->operator()(Return_base_tag(), v); }
|
||||
|
||||
Direction_3
|
||||
operator()(const Line_3& l) const
|
||||
{ return Rep(l); }
|
||||
{ return this->operator()(Return_base_tag(), l); }
|
||||
|
||||
Direction_3
|
||||
operator()(const Ray_3& r) const
|
||||
{ return Rep(r); }
|
||||
{ return this->operator()(Return_base_tag(), r); }
|
||||
|
||||
Direction_3
|
||||
operator()(const Segment_3& s) const
|
||||
{ return Rep(s); }
|
||||
{ return this->operator()(Return_base_tag(), s); }
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -2535,8 +2582,8 @@ namespace HomogeneousKernelFunctors {
|
|||
typedef Iso_rectangle_2 result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const Point_2& p, const Point_2& q, int) const
|
||||
Rep // Iso_rectangle_2
|
||||
operator()(Return_base_tag, const Point_2& p, const Point_2& q, int) const
|
||||
{
|
||||
// I have to remove the assertions, because of Cartesian_converter.
|
||||
// CGAL_kernel_assertion(p.x()<=q.x());
|
||||
|
|
@ -2544,8 +2591,8 @@ namespace HomogeneousKernelFunctors {
|
|||
return Rep(p, q, 0);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const Point_2& p, const Point_2& q) const
|
||||
Rep // Iso_rectangle_2
|
||||
operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
|
||||
{
|
||||
bool px_g_qx = ( p.hx()*q.hw() > q.hx()*p.hw() );
|
||||
bool py_g_qy = ( p.hy()*q.hw() > q.hy()*p.hw() );
|
||||
|
|
@ -2575,8 +2622,8 @@ namespace HomogeneousKernelFunctors {
|
|||
return Rep(p, q, 0);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const Point_2 &left, const Point_2 &right,
|
||||
Rep // Iso_rectangle_2
|
||||
operator()(Return_base_tag, const Point_2 &left, const Point_2 &right,
|
||||
const Point_2 &bottom, const Point_2 &top) const
|
||||
{
|
||||
CGAL_kernel_assertion_code(typename K::Less_x_2 less_x;)
|
||||
|
|
@ -2591,8 +2638,8 @@ namespace HomogeneousKernelFunctors {
|
|||
right.hw() * top.hw()), 0);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const RT& min_hx, const RT& min_hy,
|
||||
Rep // Iso_rectangle_2
|
||||
operator()(Return_base_tag, const RT& min_hx, const RT& min_hy,
|
||||
const RT& max_hx, const RT& max_hy) const
|
||||
{
|
||||
CGAL_kernel_precondition(min_hx <= max_hx);
|
||||
|
|
@ -2601,13 +2648,47 @@ namespace HomogeneousKernelFunctors {
|
|||
Point_2(max_hx, max_hy), 0);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const RT& min_hx, const RT& min_hy,
|
||||
Rep // Iso_rectangle_2
|
||||
operator()(Return_base_tag, const RT& min_hx, const RT& min_hy,
|
||||
const RT& max_hx, const RT& max_hy, const RT& hw) const
|
||||
{
|
||||
return Rep(Point_2(min_hx, min_hy, hw),
|
||||
Point_2(max_hx, max_hy, hw), 0);
|
||||
}
|
||||
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const Point_2& p, const Point_2& q, int i) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), p, q, i);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const Point_2& p, const Point_2& q) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), p, q);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const Point_2 &left, const Point_2 &right,
|
||||
const Point_2 &bottom, const Point_2 &top) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), left, right, bottom, top);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const RT& min_hx, const RT& min_hy,
|
||||
const RT& max_hx, const RT& max_hy) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy);
|
||||
}
|
||||
|
||||
Iso_rectangle_2
|
||||
operator()(const RT& min_hx, const RT& min_hy,
|
||||
const RT& max_hx, const RT& max_hy, const RT& hw) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy, hw);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -64,26 +65,26 @@ public:
|
|||
|
||||
Circle_2(const Point_2 ¢er, const FT &squared_radius,
|
||||
const Orientation &orientation)
|
||||
: RCircle_2(typename R::Construct_circle_2()(center, squared_radius, orientation)) {}
|
||||
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, squared_radius, orientation)) {}
|
||||
|
||||
Circle_2(const Point_2 ¢er, const FT &squared_radius)
|
||||
: RCircle_2(typename R::Construct_circle_2()(center, squared_radius, COUNTERCLOCKWISE)) {}
|
||||
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, squared_radius, COUNTERCLOCKWISE)) {}
|
||||
|
||||
Circle_2(const Point_2 &p, const Point_2 &q, const Point_2 &r)
|
||||
: RCircle_2(typename R::Construct_circle_2()(p,q,r)) {}
|
||||
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), p, q, r)) {}
|
||||
|
||||
Circle_2(const Point_2 & p, const Point_2 & q,
|
||||
const Orientation &orientation)
|
||||
: RCircle_2(typename R::Construct_circle_2()(p,q,orientation)) {}
|
||||
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), p, q, orientation)) {}
|
||||
|
||||
Circle_2(const Point_2 & p, const Point_2 & q)
|
||||
: RCircle_2(typename R::Construct_circle_2()(p,q,COUNTERCLOCKWISE)) {}
|
||||
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), p, q, COUNTERCLOCKWISE)) {}
|
||||
|
||||
Circle_2(const Point_2 & center, const Orientation& orientation)
|
||||
: RCircle_2(typename R::Construct_circle_2()(center,FT(0),orientation)) {}
|
||||
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, FT(0), orientation)) {}
|
||||
|
||||
Circle_2(const Point_2 & center)
|
||||
: RCircle_2(typename R::Construct_circle_2()(center,FT(0),COUNTERCLOCKWISE)) {}
|
||||
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, FT(0), COUNTERCLOCKWISE)) {}
|
||||
|
||||
typename Qualified_result_of<typename R::Construct_center_2,Circle_2>::type
|
||||
center() const
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -65,19 +66,19 @@ public:
|
|||
: RDirection_2(d) {}
|
||||
|
||||
Direction_2(const Vector_2& v)
|
||||
: RDirection_2(typename R::Construct_direction_2()(v)) {}
|
||||
: RDirection_2(typename R::Construct_direction_2()(Return_base_tag(), v)) {}
|
||||
|
||||
Direction_2(const Line_2& l)
|
||||
: RDirection_2(typename R::Construct_direction_2()(l)) {}
|
||||
: RDirection_2(typename R::Construct_direction_2()(Return_base_tag(), l)) {}
|
||||
|
||||
Direction_2(const Ray_2& r)
|
||||
: RDirection_2(typename R::Construct_direction_2()(r)) {}
|
||||
: RDirection_2(typename R::Construct_direction_2()(Return_base_tag(), r)) {}
|
||||
|
||||
Direction_2(const Segment_2& s)
|
||||
: RDirection_2(typename R::Construct_direction_2()(s)) {}
|
||||
: RDirection_2(typename R::Construct_direction_2()(Return_base_tag(), s)) {}
|
||||
|
||||
Direction_2(const RT &x, const RT &y)
|
||||
: RDirection_2(typename R::Construct_direction_2()(x,y)) {}
|
||||
: RDirection_2(typename R::Construct_direction_2()(Return_base_tag(), x,y)) {}
|
||||
|
||||
bool
|
||||
counterclockwise_in_between(const Direction_2 &d1,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -64,19 +65,19 @@ public:
|
|||
: Rep(d) {}
|
||||
|
||||
Direction_3(const Vector_3& v)
|
||||
: Rep(typename R::Construct_direction_3()(v)) {}
|
||||
: Rep(typename R::Construct_direction_3()(Return_base_tag(), v)) {}
|
||||
|
||||
Direction_3(const Line_3& l)
|
||||
: Rep(typename R::Construct_direction_3()(l)) {}
|
||||
: Rep(typename R::Construct_direction_3()(Return_base_tag(), l)) {}
|
||||
|
||||
Direction_3(const Ray_3& r)
|
||||
: Rep(typename R::Construct_direction_3()(r)) {}
|
||||
: Rep(typename R::Construct_direction_3()(Return_base_tag(), r)) {}
|
||||
|
||||
Direction_3(const Segment_3& s)
|
||||
: Rep(typename R::Construct_direction_3()(s)) {}
|
||||
: Rep(typename R::Construct_direction_3()(Return_base_tag(), s)) {}
|
||||
|
||||
Direction_3(const RT& hx, const RT& hy, const RT& hz)
|
||||
: Rep(typename R::Construct_direction_3()(hx, hy, hz)) {}
|
||||
: Rep(typename R::Construct_direction_3()(Return_base_tag(), hx, hy, hz)) {}
|
||||
|
||||
Direction_3 transform(const Aff_transformation_3 &t) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -60,26 +61,26 @@ public:
|
|||
: Rep(r) {}
|
||||
|
||||
Iso_cuboid_3(const Point_3& p, const Point_3& q)
|
||||
: Rep(typename R::Construct_iso_cuboid_3()(p,q)) {}
|
||||
: Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), p,q)) {}
|
||||
|
||||
Iso_cuboid_3(const Point_3& p, const Point_3& q, int)
|
||||
: Rep(typename R::Construct_iso_cuboid_3()(p, q, 0)) {}
|
||||
: Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), p, q, 0)) {}
|
||||
|
||||
Iso_cuboid_3(const Point_3 &left, const Point_3 &right,
|
||||
const Point_3 &bottom, const Point_3 &top,
|
||||
const Point_3 &far_, const Point_3 &close)
|
||||
: Rep(typename R::Construct_iso_cuboid_3()(left, right, bottom,
|
||||
: Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), left, right, bottom,
|
||||
top, far_, close)) {}
|
||||
|
||||
Iso_cuboid_3(const RT& min_hx, const RT& min_hy, const RT& min_hz,
|
||||
const RT& max_hx, const RT& max_hy, const RT& max_hz,
|
||||
const RT& hw)
|
||||
: Rep(typename R::Construct_iso_cuboid_3()(min_hx, min_hy, min_hz,
|
||||
: Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), min_hx, min_hy, min_hz,
|
||||
max_hx, max_hy, max_hz, hw)) {}
|
||||
|
||||
Iso_cuboid_3(const RT& min_hx, const RT& min_hy, const RT& min_hz,
|
||||
const RT& max_hx, const RT& max_hy, const RT& max_hz)
|
||||
: Rep(typename R::Construct_iso_cuboid_3()(min_hx, min_hy, min_hz,
|
||||
: Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), min_hx, min_hy, min_hz,
|
||||
max_hx, max_hy, max_hz)) {}
|
||||
|
||||
// TODO FIXME : why is Qrt not working here ?
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -62,22 +63,22 @@ public:
|
|||
: Rep(r) {}
|
||||
|
||||
Iso_rectangle_2(const Point_2 &p, const Point_2 &q, int)
|
||||
: Rep(typename R::Construct_iso_rectangle_2()(p, q, 0)) {}
|
||||
: Rep(typename R::Construct_iso_rectangle_2()(Return_base_tag(), p, q, 0)) {}
|
||||
|
||||
Iso_rectangle_2(const Point_2 &p, const Point_2 &q)
|
||||
: Rep(typename R::Construct_iso_rectangle_2()(p, q)) {}
|
||||
: Rep(typename R::Construct_iso_rectangle_2()(Return_base_tag(), p, q)) {}
|
||||
|
||||
Iso_rectangle_2(const Point_2 &left, const Point_2 &right,
|
||||
const Point_2 &bottom, const Point_2 &top)
|
||||
: Rep(typename R::Construct_iso_rectangle_2()(left, right, bottom, top)) {}
|
||||
: Rep(typename R::Construct_iso_rectangle_2()(Return_base_tag(), left, right, bottom, top)) {}
|
||||
|
||||
Iso_rectangle_2(const RT& min_hx, const RT& min_hy,
|
||||
const RT& max_hx, const RT& max_hy)
|
||||
: Rep(typename R::Construct_iso_rectangle_2()(min_hx, min_hy, max_hx, max_hy)) {}
|
||||
: Rep(typename R::Construct_iso_rectangle_2()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy)) {}
|
||||
|
||||
Iso_rectangle_2(const RT& min_hx, const RT& min_hy,
|
||||
const RT& max_hx, const RT& max_hy, const RT& hw)
|
||||
: Rep(typename R::Construct_iso_rectangle_2()(min_hx, min_hy, max_hx, max_hy, hw)) {}
|
||||
: Rep(typename R::Construct_iso_rectangle_2()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy, hw)) {}
|
||||
|
||||
|
||||
typename Qualified_result_of<typename R::Construct_min_vertex_2, Iso_rectangle_2 >::type
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (c) 2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Sylvain Pion
|
||||
|
||||
#ifndef CGAL_KERNEL_RETURN_BASE_TAG_H
|
||||
#define CGAL_KERNEL_RETURN_BASE_TAG_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
// This is a simple tag which is used as additional (first) argument in
|
||||
// some kernel functors, to tell them to return the base (rep) class,
|
||||
// instead of the main type (e.g. Kernel_base::Point_2 instead
|
||||
// of Kernel::Point_2). This is a minor optimization which prevents
|
||||
// useless copies of the "reps".
|
||||
|
||||
// Those functors are only those used in the constructors of the kernel
|
||||
// types like Point_2, so it's limited.
|
||||
|
||||
// The real solution will be to use "forwarding constructors", when they
|
||||
// will be available in C++.
|
||||
// In the mean time, this should be a mostly/hopefully internal hack.
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
struct Return_base_tag {};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
#include <CGAL/squared_distance_3.h>
|
||||
#include <CGAL/intersection_2.h>
|
||||
#include <CGAL/intersection_3.h>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -662,12 +663,14 @@ namespace CommonKernelFunctors {
|
|||
typedef Arity_tag< 3 > Arity;
|
||||
|
||||
Rep // Circle_2
|
||||
operator()( const Point_2& center, const FT& squared_radius,
|
||||
operator()( Return_base_tag,
|
||||
const Point_2& center, const FT& squared_radius,
|
||||
Orientation orientation = COUNTERCLOCKWISE) const
|
||||
{ return Rep(center, squared_radius, orientation); }
|
||||
|
||||
Rep // Circle_2
|
||||
operator()( const Point_2& p, const Point_2& q, const Point_2& r) const
|
||||
operator()( Return_base_tag,
|
||||
const Point_2& p, const Point_2& q, const Point_2& r) const
|
||||
{
|
||||
typename K::Orientation_2 orientation;
|
||||
typename K::Compute_squared_distance_2 squared_distance;
|
||||
|
|
@ -681,7 +684,8 @@ namespace CommonKernelFunctors {
|
|||
}
|
||||
|
||||
Rep // Circle_2
|
||||
operator()( const Point_2& p, const Point_2& q,
|
||||
operator()( Return_base_tag,
|
||||
const Point_2& p, const Point_2& q,
|
||||
Orientation orientation = COUNTERCLOCKWISE) const
|
||||
{
|
||||
CGAL_kernel_precondition( orientation != COLLINEAR);
|
||||
|
|
@ -696,13 +700,42 @@ namespace CommonKernelFunctors {
|
|||
}
|
||||
|
||||
Rep // Circle_2
|
||||
operator()( const Point_2& center,
|
||||
operator()( Return_base_tag, const Point_2& center,
|
||||
Orientation orientation = COUNTERCLOCKWISE) const
|
||||
{
|
||||
CGAL_kernel_precondition( orientation != COLLINEAR );
|
||||
|
||||
return Rep(center, FT(0), orientation);
|
||||
}
|
||||
|
||||
|
||||
Circle_2
|
||||
operator()( const Point_2& center, const FT& squared_radius,
|
||||
Orientation orientation = COUNTERCLOCKWISE) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(),
|
||||
center, squared_radius, orientation);
|
||||
}
|
||||
|
||||
Circle_2
|
||||
operator()( const Point_2& p, const Point_2& q, const Point_2& r) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), p, q, r);
|
||||
}
|
||||
|
||||
Circle_2
|
||||
operator()( const Point_2& p, const Point_2& q,
|
||||
Orientation orientation = COUNTERCLOCKWISE) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), p, q, orientation);
|
||||
}
|
||||
|
||||
Circle_2
|
||||
operator()( const Point_2& center,
|
||||
Orientation orientation = COUNTERCLOCKWISE) const
|
||||
{
|
||||
return this->operator()(Return_base_tag(), center, orientation);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
|
|
@ -717,30 +750,55 @@ namespace CommonKernelFunctors {
|
|||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
Rep // Iso_cuboid_3
|
||||
operator()(const Point_3& p, const Point_3& q, int) const
|
||||
operator()(Return_base_tag, const Point_3& p, const Point_3& q, int) const
|
||||
{ return Rep(p, q, 0); }
|
||||
|
||||
Rep // Iso_cuboid_3
|
||||
operator()(const Point_3& p, const Point_3& q) const
|
||||
operator()(Return_base_tag, const Point_3& p, const Point_3& q) const
|
||||
{ return Rep(p, q); }
|
||||
|
||||
Rep // Iso_cuboid_3
|
||||
operator()(const Point_3 &left, const Point_3 &right,
|
||||
operator()(Return_base_tag, const Point_3 &left, const Point_3 &right,
|
||||
const Point_3 &bottom, const Point_3 &top,
|
||||
const Point_3 &far_, const Point_3 &close) const
|
||||
{ return Rep(left, right, bottom, top, far_, close); }
|
||||
|
||||
Rep // Iso_cuboid_3
|
||||
operator()(const RT& min_hx, const RT& min_hy, const RT& min_hz,
|
||||
operator()(Return_base_tag, const RT& min_hx, const RT& min_hy, const RT& min_hz,
|
||||
const RT& max_hx, const RT& max_hy, const RT& max_hz,
|
||||
const RT& hw) const
|
||||
{ return Rep(min_hx, min_hy, min_hz, max_hx, max_hy, max_hz, hw); }
|
||||
|
||||
Rep // Iso_cuboid_3
|
||||
operator()(const RT& min_hx, const RT& min_hy, const RT& min_hz,
|
||||
operator()(Return_base_tag, const RT& min_hx, const RT& min_hy, const RT& min_hz,
|
||||
const RT& max_hx, const RT& max_hy, const RT& max_hz) const
|
||||
{ return Rep(min_hx, min_hy, min_hz, max_hx, max_hy, max_hz); }
|
||||
|
||||
|
||||
Iso_cuboid_3
|
||||
operator()(const Point_3& p, const Point_3& q, int) const
|
||||
{ return this->operator()(Return_base_tag(), p, q, 0); }
|
||||
|
||||
Iso_cuboid_3
|
||||
operator()(const Point_3& p, const Point_3& q) const
|
||||
{ return this->operator()(Return_base_tag(), p, q); }
|
||||
|
||||
Iso_cuboid_3
|
||||
operator()(const Point_3 &left, const Point_3 &right,
|
||||
const Point_3 &bottom, const Point_3 &top,
|
||||
const Point_3 &far_, const Point_3 &close) const
|
||||
{ return this->operator()(Return_base_tag(), left, right, bottom, top, far_, close); }
|
||||
|
||||
Iso_cuboid_3
|
||||
operator()(const RT& min_hx, const RT& min_hy, const RT& min_hz,
|
||||
const RT& max_hx, const RT& max_hy, const RT& max_hz,
|
||||
const RT& hw) const
|
||||
{ return this->operator()(Return_base_tag(), min_hx, min_hy, min_hz, max_hx, max_hy, max_hz, hw); }
|
||||
|
||||
Iso_cuboid_3
|
||||
operator()(const RT& min_hx, const RT& min_hy, const RT& min_hz,
|
||||
const RT& max_hx, const RT& max_hy, const RT& max_hz) const
|
||||
{ return this->operator()(Return_base_tag(), min_hx, min_hy, min_hz, max_hx, max_hy, max_hz); }
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
|
|
|
|||
Loading…
Reference in New Issue