diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h index b7e65ad1882..ef050900371 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h @@ -25,8 +25,6 @@ #define CGAL_CARTESIAN_POINT_2_H #include -#include -#include CGAL_BEGIN_NAMESPACE @@ -38,16 +36,12 @@ class PointC2 typedef typename R_::Vector_2 Vector_2; typedef typename R_::Point_2 Point_2; -// TODO : we now have 2 layers of reference counting. -// => maybe simply suppress the one at this level? - typedef Vector_2 Rep; - typedef typename R_::template Handle::type Base; - - Base base; + // We do not use reference counting here as it is done at the Vector_2 level. + Vector_2 base; public: - typedef typename Rep::Cartesian_const_iterator Cartesian_const_iterator; + typedef typename Vector_2::Cartesian_const_iterator Cartesian_const_iterator; typedef R_ R; @@ -64,40 +58,40 @@ public: const FT& x() const { - return get(base).x(); + return base.x(); } const FT& y() const { - return get(base).y(); + return base.y(); } const FT& hx() const { - return x(); + return base.hx(); } const FT& hy() const { - return y(); + return base.hy(); } const FT& hw() const { - return constant(); + return base.hw(); } Cartesian_const_iterator cartesian_begin() const { - return get(base).cartesian_begin(); + return base.cartesian_begin(); } Cartesian_const_iterator cartesian_end() const { - return get(base).cartesian_end(); + return base.cartesian_end(); } bool operator==(const PointC2 &p) const { - return get(base) == get(p.base); + return base == p.base; } bool operator!=(const PointC2 &p) const { diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h index afdc52c2582..420527d910e 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h @@ -24,9 +24,7 @@ #ifndef CGAL_CARTESIAN_POINT_3_H #define CGAL_CARTESIAN_POINT_3_H -#include #include -#include CGAL_BEGIN_NAMESPACE @@ -38,14 +36,11 @@ class PointC3 typedef typename R_::Point_3 Point_3; typedef typename R_::Aff_transformation_3 Aff_transformation_3; -// TODO : we have 2 levels of ref-counting here. - typedef Vector_3 Rep; - typedef typename R_::template Handle::type Base; - - Base base; + // We do not use reference counting here as it is done at the Vector_3 level. + Vector_3 base; public: - typedef typename Rep::Cartesian_const_iterator Cartesian_const_iterator; + typedef typename Vector_3::Cartesian_const_iterator Cartesian_const_iterator; typedef R_ R; PointC3() {} @@ -61,32 +56,32 @@ public: const FT & x() const { - return get(base).x(); + return base.x(); } const FT & y() const { - return get(base).y(); + return base.y(); } const FT & z() const { - return get(base).z(); + return base.z(); } const FT & hx() const { - return x(); + return base.hx(); } const FT & hy() const { - return y(); + return base.hy(); } const FT & hz() const { - return z(); + return base.hz(); } const FT & hw() const { - return constant(); + return base.hw(); } const FT & cartesian(int i) const; @@ -95,17 +90,17 @@ public: Cartesian_const_iterator cartesian_begin() const { - return get(base).cartesian_begin(); + return base.cartesian_begin(); } Cartesian_const_iterator cartesian_end() const { - return get(base).cartesian_end(); + return base.cartesian_end(); } int dimension() const { - return get(base).dimension(); + return base.dimension(); } Point_3 transform(const Aff_transformation_3 &t) const @@ -119,7 +114,7 @@ inline const typename PointC3::FT & PointC3::cartesian(int i) const { - return get(base).cartesian(i); + return base.cartesian(i); } template < class R > @@ -127,7 +122,7 @@ inline const typename PointC3::FT & PointC3::operator[](int i) const { - return get(base)[i]; + return base[i]; } template < class R > @@ -135,7 +130,7 @@ inline const typename PointC3::FT & PointC3::homogeneous(int i) const { - return get(base).homogeneous(i); + return base.homogeneous(i); } CGAL_END_NAMESPACE diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h index 59aabbb11bf..df8d3d9cb24 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h @@ -26,6 +26,7 @@ #include #include +#include CGAL_BEGIN_NAMESPACE diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h index 48a0aeba889..d71c03eb388 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h @@ -42,19 +42,16 @@ class PointH2 typedef typename R_::Point_2 Point_2; typedef typename R_::Direction_2 Direction_2; -// TODO : we have 2 levels of ref-counting here. - typedef Vector_2 Rep; - typedef typename R_::template Handle::type Base; - typedef Rational_traits Rat_traits; - Base base; + // Reference-counting is handled in Vector_2. + Vector_2 base; public: typedef FT Cartesian_coordinate_type; typedef const RT& Homogeneous_coordinate_type; - typedef typename Rep::Cartesian_const_iterator Cartesian_const_iterator; + typedef typename Vector_2::Cartesian_const_iterator Cartesian_const_iterator; typedef R_ R; PointH2() {} @@ -77,9 +74,9 @@ public: bool operator==( const PointH2& p) const; bool operator!=( const PointH2& p) const; - const RT & hx() const { return get(base).hx(); } - const RT & hy() const { return get(base).hy(); } - const RT & hw() const { return get(base).hw(); } + const RT & hx() const { return base.hx(); } + const RT & hy() const { return base.hy(); } + const RT & hw() const { return base.hw(); } FT x() const { return FT(hx()) / FT(hw()); } FT y() const { return FT(hy()) / FT(hw()); } @@ -90,12 +87,12 @@ public: Cartesian_const_iterator cartesian_begin() const { - return get(base).cartesian_begin(); + return base.cartesian_begin(); } Cartesian_const_iterator cartesian_end() const { - return get(base).cartesian_end(); + return base.cartesian_end(); } int dimension() const; @@ -104,11 +101,11 @@ public: }; template < class R > -CGAL_KERNEL_INLINE +inline bool PointH2::operator==( const PointH2& p) const { - return get(base) == get(p.base); + return base == p.base; } template < class R > @@ -118,36 +115,36 @@ PointH2::operator!=( const PointH2& p) const { return !(*this == p); } template < class R > -CGAL_KERNEL_INLINE +inline typename PointH2::FT PointH2::cartesian(int i) const { - return get(base).cartesian(i); + return base.cartesian(i); } template < class R > -CGAL_KERNEL_INLINE +inline const typename PointH2::RT & PointH2::homogeneous(int i) const { - return get(base).homogeneous(i); + return base.homogeneous(i); } template < class R > inline typename PointH2::FT PointH2::operator[](int i) const -{ return get(base)[i]; } +{ return base[i]; } template < class R > inline int PointH2::dimension() const -{ return get(base).dimension(); } +{ return base.dimension(); } template < class R > -CGAL_KERNEL_INLINE +inline typename PointH2::Direction_2 PointH2::direction() const { return typename PointH2::Direction_2(*this); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h index df37995719b..ca966a064e9 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h @@ -42,16 +42,14 @@ class PointH3 typedef typename R_::Direction_3 Direction_3; typedef typename R_::Aff_transformation_3 Aff_transformation_3; - typedef Vector_3 Rep; - typedef typename R_::template Handle::type Base; - typedef Rational_traits Rat_traits; - Base base; + // Reference-counting is handled in Vector_3. + Vector_3 base; public: - typedef typename Rep::Cartesian_const_iterator Cartesian_const_iterator; + typedef typename Vector_3::Cartesian_const_iterator Cartesian_const_iterator; typedef R_ R; PointH3() {} @@ -86,12 +84,12 @@ public: Cartesian_const_iterator cartesian_begin() const { - return get(base).cartesian_begin(); + return base.cartesian_begin(); } Cartesian_const_iterator cartesian_end() const { - return get(base).cartesian_end(); + return base.cartesian_end(); } int dimension() const; @@ -108,64 +106,64 @@ template < class R > inline const typename PointH3::RT & PointH3::hx() const -{ return get(base).hx(); } +{ return base.hx(); } template < class R > inline const typename PointH3::RT & PointH3::hy() const -{ return get(base).hy(); } +{ return base.hy(); } template < class R > inline const typename PointH3::RT & PointH3::hz() const -{ return get(base).hz(); } +{ return base.hz(); } template < class R > inline const typename PointH3::RT & PointH3::hw() const -{ return get(base).hw(); } +{ return base.hw(); } template < class R > -CGAL_KERNEL_INLINE +inline typename PointH3::FT PointH3::x() const -{ return FT(hx()) / FT(hw()); } +{ return base.x(); } template < class R > -CGAL_KERNEL_INLINE +inline typename PointH3::FT PointH3::y() const -{ return FT(hy()) / FT(hw()); } +{ return base.y(); } template < class R > -CGAL_KERNEL_INLINE +inline typename PointH3::FT PointH3::z() const -{ return FT(hz()) / FT(hw()); } +{ return base.z(); } template < class R > inline int PointH3::dimension() const -{ return get(base).dimension(); } +{ return base.dimension(); } template < class R > -CGAL_KERNEL_INLINE +inline typename PointH3::FT PointH3::cartesian(int i) const { - return get(base).cartesian(i); + return base.cartesian(i); } template < class R > -CGAL_KERNEL_INLINE +inline const typename PointH3::RT & PointH3::homogeneous(int i) const { - return get(base).homogeneous(i); + return base.homogeneous(i); } template < class R > @@ -173,7 +171,7 @@ inline typename PointH3::FT PointH3::operator[](int i) const { - return get(base)[i]; + return base[i]; } template < class R > @@ -183,11 +181,11 @@ PointH3::direction() const { return Direction_3(*this); } template < class R > -CGAL_KERNEL_INLINE +inline bool PointH3::operator==( const PointH3 & p) const { - return get(base) == get(p.base); + return base == p.base; } template < class R >