add version for Point_2/Vector_2

This commit is contained in:
Sébastien Loriot
2023-10-09 12:30:37 +02:00
parent 74a0aa8c20
commit fbd24d665d
5 changed files with 39 additions and 4 deletions
@@ -47,6 +47,11 @@ public:
PointC2(const FT &x, const FT &y)
: base(x, y) {}
template <class T1, class T2>
PointC2(T1 &&x, T2 &&y)
: base(std::forward<T1>(x), std::forward<T2>(y))
{}
PointC2(const FT &hx, const FT &hy, const FT &hw)
: base(hx, hy, hw) {}
@@ -50,7 +50,11 @@ public:
VectorC2() {}
VectorC2(const FT &x, const FT &y)
: base(CGAL::make_array(x, y)) {}
: base(Rep{x, y}) {}
template <class T1, class T2>
VectorC2(T1 &&x, T2 &&y)
: base(fwd_make_array<FT>(std::forward<T1>(x), std::forward<T2>(y))) {}
VectorC2(const FT &hx, const FT &hy, const FT &hw)
: base( hw != FT(1) ? CGAL::make_array<FT>(hx/hw, hy/hw)
@@ -3084,6 +3084,11 @@ namespace CartesianKernelFunctors {
operator()(Return_base_tag, const RT& x, const RT& y) const
{ return Rep(x, y); }
template <class T1, class T2>
Rep
operator()(T1&& x, T2&& y) const
{ return Rep(std::forward<T1>(x), std::forward<T2>(y)); }
Rep // Point_2
operator()(Return_base_tag, const RT& x, const RT& y, const RT& w) const
{ return Rep(x, y, w); }
@@ -3533,6 +3538,12 @@ namespace CartesianKernelFunctors {
operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
{ return Rep(q.x() - p.x(), q.y() - p.y()); }
// note that compared to Vector_3 this one is needed as it could be ambiguous
// with operator()(Rbt,FT,FT) version
Rep // Vector_2
operator()(Return_base_tag, Point_2&& p, Point_2&& q) const
{ return Rep(q.x() - p.x(), q.y() - p.y()); }
Rep // Vector_2
operator()(Return_base_tag, const Origin&, const Point_2& q) const
{ return Rep(q.x(), q.y()); }
@@ -3565,12 +3576,15 @@ namespace CartesianKernelFunctors {
operator()(Return_base_tag, const RT& x, const RT& y) const
{ return Rep(x, y); }
template<class T1, class T2>
Rep // Vector_2
operator()(Return_base_tag, T1&& x, T2&& y) const
{ return Rep(/* std::forward<T1>(x), std::forward<T2>(y) */); }
Rep // Vector_2
operator()(Return_base_tag, const RT& x, const RT& y, const RT& w) const
{ return Rep(x, y, w); }
Vector_2
operator()( const Point_2& p, const Point_2& q) const
{ return this->operator()(Return_base_tag(), p, q); }