mirror of https://github.com/CGAL/cgal
Remove the reference-counting inside Point_2 and Point_3, as they now store
only a Vector_2 and Vector_3 which is responsible for the reference-counting.
This commit is contained in:
parent
451039a260
commit
7ace759d8e
|
|
@ -25,8 +25,6 @@
|
||||||
#define CGAL_CARTESIAN_POINT_2_H
|
#define CGAL_CARTESIAN_POINT_2_H
|
||||||
|
|
||||||
#include <CGAL/Origin.h>
|
#include <CGAL/Origin.h>
|
||||||
#include <CGAL/Handle_for.h>
|
|
||||||
#include <CGAL/constant.h>
|
|
||||||
|
|
||||||
CGAL_BEGIN_NAMESPACE
|
CGAL_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
@ -38,16 +36,12 @@ class PointC2
|
||||||
typedef typename R_::Vector_2 Vector_2;
|
typedef typename R_::Vector_2 Vector_2;
|
||||||
typedef typename R_::Point_2 Point_2;
|
typedef typename R_::Point_2 Point_2;
|
||||||
|
|
||||||
// TODO : we now have 2 layers of reference counting.
|
// We do not use reference counting here as it is done at the Vector_2 level.
|
||||||
// => maybe simply suppress the one at this level?
|
Vector_2 base;
|
||||||
typedef Vector_2 Rep;
|
|
||||||
typedef typename R_::template Handle<Rep>::type Base;
|
|
||||||
|
|
||||||
Base base;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef typename Rep::Cartesian_const_iterator Cartesian_const_iterator;
|
typedef typename Vector_2::Cartesian_const_iterator Cartesian_const_iterator;
|
||||||
|
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
|
|
||||||
|
|
@ -64,40 +58,40 @@ public:
|
||||||
|
|
||||||
const FT& x() const
|
const FT& x() const
|
||||||
{
|
{
|
||||||
return get(base).x();
|
return base.x();
|
||||||
}
|
}
|
||||||
|
|
||||||
const FT& y() const
|
const FT& y() const
|
||||||
{
|
{
|
||||||
return get(base).y();
|
return base.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
const FT& hx() const
|
const FT& hx() const
|
||||||
{
|
{
|
||||||
return x();
|
return base.hx();
|
||||||
}
|
}
|
||||||
const FT& hy() const
|
const FT& hy() const
|
||||||
{
|
{
|
||||||
return y();
|
return base.hy();
|
||||||
}
|
}
|
||||||
const FT& hw() const
|
const FT& hw() const
|
||||||
{
|
{
|
||||||
return constant<FT, 1>();
|
return base.hw();
|
||||||
}
|
}
|
||||||
|
|
||||||
Cartesian_const_iterator cartesian_begin() const
|
Cartesian_const_iterator cartesian_begin() const
|
||||||
{
|
{
|
||||||
return get(base).cartesian_begin();
|
return base.cartesian_begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
Cartesian_const_iterator cartesian_end() const
|
Cartesian_const_iterator cartesian_end() const
|
||||||
{
|
{
|
||||||
return get(base).cartesian_end();
|
return base.cartesian_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const PointC2 &p) const
|
bool operator==(const PointC2 &p) const
|
||||||
{
|
{
|
||||||
return get(base) == get(p.base);
|
return base == p.base;
|
||||||
}
|
}
|
||||||
bool operator!=(const PointC2 &p) const
|
bool operator!=(const PointC2 &p) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,7 @@
|
||||||
#ifndef CGAL_CARTESIAN_POINT_3_H
|
#ifndef CGAL_CARTESIAN_POINT_3_H
|
||||||
#define CGAL_CARTESIAN_POINT_3_H
|
#define CGAL_CARTESIAN_POINT_3_H
|
||||||
|
|
||||||
#include <CGAL/Handle_for.h>
|
|
||||||
#include <CGAL/Origin.h>
|
#include <CGAL/Origin.h>
|
||||||
#include <CGAL/constant.h>
|
|
||||||
|
|
||||||
CGAL_BEGIN_NAMESPACE
|
CGAL_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
@ -38,14 +36,11 @@ class PointC3
|
||||||
typedef typename R_::Point_3 Point_3;
|
typedef typename R_::Point_3 Point_3;
|
||||||
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
|
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
|
||||||
|
|
||||||
// TODO : we have 2 levels of ref-counting here.
|
// We do not use reference counting here as it is done at the Vector_3 level.
|
||||||
typedef Vector_3 Rep;
|
Vector_3 base;
|
||||||
typedef typename R_::template Handle<Rep>::type Base;
|
|
||||||
|
|
||||||
Base base;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename Rep::Cartesian_const_iterator Cartesian_const_iterator;
|
typedef typename Vector_3::Cartesian_const_iterator Cartesian_const_iterator;
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
|
|
||||||
PointC3() {}
|
PointC3() {}
|
||||||
|
|
@ -61,32 +56,32 @@ public:
|
||||||
|
|
||||||
const FT & x() const
|
const FT & x() const
|
||||||
{
|
{
|
||||||
return get(base).x();
|
return base.x();
|
||||||
}
|
}
|
||||||
const FT & y() const
|
const FT & y() const
|
||||||
{
|
{
|
||||||
return get(base).y();
|
return base.y();
|
||||||
}
|
}
|
||||||
const FT & z() const
|
const FT & z() const
|
||||||
{
|
{
|
||||||
return get(base).z();
|
return base.z();
|
||||||
}
|
}
|
||||||
|
|
||||||
const FT & hx() const
|
const FT & hx() const
|
||||||
{
|
{
|
||||||
return x();
|
return base.hx();
|
||||||
}
|
}
|
||||||
const FT & hy() const
|
const FT & hy() const
|
||||||
{
|
{
|
||||||
return y();
|
return base.hy();
|
||||||
}
|
}
|
||||||
const FT & hz() const
|
const FT & hz() const
|
||||||
{
|
{
|
||||||
return z();
|
return base.hz();
|
||||||
}
|
}
|
||||||
const FT & hw() const
|
const FT & hw() const
|
||||||
{
|
{
|
||||||
return constant<FT, 1>();
|
return base.hw();
|
||||||
}
|
}
|
||||||
|
|
||||||
const FT & cartesian(int i) const;
|
const FT & cartesian(int i) const;
|
||||||
|
|
@ -95,17 +90,17 @@ public:
|
||||||
|
|
||||||
Cartesian_const_iterator cartesian_begin() const
|
Cartesian_const_iterator cartesian_begin() const
|
||||||
{
|
{
|
||||||
return get(base).cartesian_begin();
|
return base.cartesian_begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
Cartesian_const_iterator cartesian_end() const
|
Cartesian_const_iterator cartesian_end() const
|
||||||
{
|
{
|
||||||
return get(base).cartesian_end();
|
return base.cartesian_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
int dimension() const
|
int dimension() const
|
||||||
{
|
{
|
||||||
return get(base).dimension();
|
return base.dimension();
|
||||||
}
|
}
|
||||||
|
|
||||||
Point_3 transform(const Aff_transformation_3 &t) const
|
Point_3 transform(const Aff_transformation_3 &t) const
|
||||||
|
|
@ -119,7 +114,7 @@ inline
|
||||||
const typename PointC3<R>::FT &
|
const typename PointC3<R>::FT &
|
||||||
PointC3<R>::cartesian(int i) const
|
PointC3<R>::cartesian(int i) const
|
||||||
{
|
{
|
||||||
return get(base).cartesian(i);
|
return base.cartesian(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
|
|
@ -127,7 +122,7 @@ inline
|
||||||
const typename PointC3<R>::FT &
|
const typename PointC3<R>::FT &
|
||||||
PointC3<R>::operator[](int i) const
|
PointC3<R>::operator[](int i) const
|
||||||
{
|
{
|
||||||
return get(base)[i];
|
return base[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
|
|
@ -135,7 +130,7 @@ inline
|
||||||
const typename PointC3<R>::FT &
|
const typename PointC3<R>::FT &
|
||||||
PointC3<R>::homogeneous(int i) const
|
PointC3<R>::homogeneous(int i) const
|
||||||
{
|
{
|
||||||
return get(base).homogeneous(i);
|
return base.homogeneous(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL_END_NAMESPACE
|
CGAL_END_NAMESPACE
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <CGAL/Origin.h>
|
#include <CGAL/Origin.h>
|
||||||
#include <CGAL/array.h>
|
#include <CGAL/array.h>
|
||||||
|
#include <CGAL/constant.h>
|
||||||
|
|
||||||
CGAL_BEGIN_NAMESPACE
|
CGAL_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,19 +42,16 @@ class PointH2
|
||||||
typedef typename R_::Point_2 Point_2;
|
typedef typename R_::Point_2 Point_2;
|
||||||
typedef typename R_::Direction_2 Direction_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<Rep>::type Base;
|
|
||||||
|
|
||||||
typedef Rational_traits<FT> Rat_traits;
|
typedef Rational_traits<FT> Rat_traits;
|
||||||
|
|
||||||
Base base;
|
// Reference-counting is handled in Vector_2.
|
||||||
|
Vector_2 base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef FT Cartesian_coordinate_type;
|
typedef FT Cartesian_coordinate_type;
|
||||||
typedef const RT& Homogeneous_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;
|
typedef R_ R;
|
||||||
|
|
||||||
PointH2() {}
|
PointH2() {}
|
||||||
|
|
@ -77,9 +74,9 @@ public:
|
||||||
bool operator==( const PointH2<R>& p) const;
|
bool operator==( const PointH2<R>& p) const;
|
||||||
bool operator!=( const PointH2<R>& p) const;
|
bool operator!=( const PointH2<R>& p) const;
|
||||||
|
|
||||||
const RT & hx() const { return get(base).hx(); }
|
const RT & hx() const { return base.hx(); }
|
||||||
const RT & hy() const { return get(base).hy(); }
|
const RT & hy() const { return base.hy(); }
|
||||||
const RT & hw() const { return get(base).hw(); }
|
const RT & hw() const { return base.hw(); }
|
||||||
|
|
||||||
FT x() const { return FT(hx()) / FT(hw()); }
|
FT x() const { return FT(hx()) / FT(hw()); }
|
||||||
FT y() const { return FT(hy()) / FT(hw()); }
|
FT y() const { return FT(hy()) / FT(hw()); }
|
||||||
|
|
@ -90,12 +87,12 @@ public:
|
||||||
|
|
||||||
Cartesian_const_iterator cartesian_begin() const
|
Cartesian_const_iterator cartesian_begin() const
|
||||||
{
|
{
|
||||||
return get(base).cartesian_begin();
|
return base.cartesian_begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
Cartesian_const_iterator cartesian_end() const
|
Cartesian_const_iterator cartesian_end() const
|
||||||
{
|
{
|
||||||
return get(base).cartesian_end();
|
return base.cartesian_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
int dimension() const;
|
int dimension() const;
|
||||||
|
|
@ -104,11 +101,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
CGAL_KERNEL_INLINE
|
inline
|
||||||
bool
|
bool
|
||||||
PointH2<R>::operator==( const PointH2<R>& p) const
|
PointH2<R>::operator==( const PointH2<R>& p) const
|
||||||
{
|
{
|
||||||
return get(base) == get(p.base);
|
return base == p.base;
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
|
|
@ -118,36 +115,36 @@ PointH2<R>::operator!=( const PointH2<R>& p) const
|
||||||
{ return !(*this == p); }
|
{ return !(*this == p); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
CGAL_KERNEL_INLINE
|
inline
|
||||||
typename PointH2<R>::FT
|
typename PointH2<R>::FT
|
||||||
PointH2<R>::cartesian(int i) const
|
PointH2<R>::cartesian(int i) const
|
||||||
{
|
{
|
||||||
return get(base).cartesian(i);
|
return base.cartesian(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
CGAL_KERNEL_INLINE
|
inline
|
||||||
const typename PointH2<R>::RT &
|
const typename PointH2<R>::RT &
|
||||||
PointH2<R>::homogeneous(int i) const
|
PointH2<R>::homogeneous(int i) const
|
||||||
{
|
{
|
||||||
return get(base).homogeneous(i);
|
return base.homogeneous(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
inline
|
inline
|
||||||
typename PointH2<R>::FT
|
typename PointH2<R>::FT
|
||||||
PointH2<R>::operator[](int i) const
|
PointH2<R>::operator[](int i) const
|
||||||
{ return get(base)[i]; }
|
{ return base[i]; }
|
||||||
|
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
inline
|
inline
|
||||||
int
|
int
|
||||||
PointH2<R>::dimension() const
|
PointH2<R>::dimension() const
|
||||||
{ return get(base).dimension(); }
|
{ return base.dimension(); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
CGAL_KERNEL_INLINE
|
inline
|
||||||
typename PointH2<R>::Direction_2
|
typename PointH2<R>::Direction_2
|
||||||
PointH2<R>::direction() const
|
PointH2<R>::direction() const
|
||||||
{ return typename PointH2<R>::Direction_2(*this); }
|
{ return typename PointH2<R>::Direction_2(*this); }
|
||||||
|
|
|
||||||
|
|
@ -42,16 +42,14 @@ class PointH3
|
||||||
typedef typename R_::Direction_3 Direction_3;
|
typedef typename R_::Direction_3 Direction_3;
|
||||||
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
|
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
|
||||||
|
|
||||||
typedef Vector_3 Rep;
|
|
||||||
typedef typename R_::template Handle<Rep>::type Base;
|
|
||||||
|
|
||||||
typedef Rational_traits<FT> Rat_traits;
|
typedef Rational_traits<FT> Rat_traits;
|
||||||
|
|
||||||
Base base;
|
// Reference-counting is handled in Vector_3.
|
||||||
|
Vector_3 base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef typename Rep::Cartesian_const_iterator Cartesian_const_iterator;
|
typedef typename Vector_3::Cartesian_const_iterator Cartesian_const_iterator;
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
|
|
||||||
PointH3() {}
|
PointH3() {}
|
||||||
|
|
@ -86,12 +84,12 @@ public:
|
||||||
|
|
||||||
Cartesian_const_iterator cartesian_begin() const
|
Cartesian_const_iterator cartesian_begin() const
|
||||||
{
|
{
|
||||||
return get(base).cartesian_begin();
|
return base.cartesian_begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
Cartesian_const_iterator cartesian_end() const
|
Cartesian_const_iterator cartesian_end() const
|
||||||
{
|
{
|
||||||
return get(base).cartesian_end();
|
return base.cartesian_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
int dimension() const;
|
int dimension() const;
|
||||||
|
|
@ -108,64 +106,64 @@ template < class R >
|
||||||
inline
|
inline
|
||||||
const typename PointH3<R>::RT &
|
const typename PointH3<R>::RT &
|
||||||
PointH3<R>::hx() const
|
PointH3<R>::hx() const
|
||||||
{ return get(base).hx(); }
|
{ return base.hx(); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
inline
|
inline
|
||||||
const typename PointH3<R>::RT &
|
const typename PointH3<R>::RT &
|
||||||
PointH3<R>::hy() const
|
PointH3<R>::hy() const
|
||||||
{ return get(base).hy(); }
|
{ return base.hy(); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
inline
|
inline
|
||||||
const typename PointH3<R>::RT &
|
const typename PointH3<R>::RT &
|
||||||
PointH3<R>::hz() const
|
PointH3<R>::hz() const
|
||||||
{ return get(base).hz(); }
|
{ return base.hz(); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
inline
|
inline
|
||||||
const typename PointH3<R>::RT &
|
const typename PointH3<R>::RT &
|
||||||
PointH3<R>::hw() const
|
PointH3<R>::hw() const
|
||||||
{ return get(base).hw(); }
|
{ return base.hw(); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
CGAL_KERNEL_INLINE
|
inline
|
||||||
typename PointH3<R>::FT
|
typename PointH3<R>::FT
|
||||||
PointH3<R>::x() const
|
PointH3<R>::x() const
|
||||||
{ return FT(hx()) / FT(hw()); }
|
{ return base.x(); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
CGAL_KERNEL_INLINE
|
inline
|
||||||
typename PointH3<R>::FT
|
typename PointH3<R>::FT
|
||||||
PointH3<R>::y() const
|
PointH3<R>::y() const
|
||||||
{ return FT(hy()) / FT(hw()); }
|
{ return base.y(); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
CGAL_KERNEL_INLINE
|
inline
|
||||||
typename PointH3<R>::FT
|
typename PointH3<R>::FT
|
||||||
PointH3<R>::z() const
|
PointH3<R>::z() const
|
||||||
{ return FT(hz()) / FT(hw()); }
|
{ return base.z(); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
inline
|
inline
|
||||||
int
|
int
|
||||||
PointH3<R>::dimension() const
|
PointH3<R>::dimension() const
|
||||||
{ return get(base).dimension(); }
|
{ return base.dimension(); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
CGAL_KERNEL_INLINE
|
inline
|
||||||
typename PointH3<R>::FT
|
typename PointH3<R>::FT
|
||||||
PointH3<R>::cartesian(int i) const
|
PointH3<R>::cartesian(int i) const
|
||||||
{
|
{
|
||||||
return get(base).cartesian(i);
|
return base.cartesian(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
CGAL_KERNEL_INLINE
|
inline
|
||||||
const typename PointH3<R>::RT &
|
const typename PointH3<R>::RT &
|
||||||
PointH3<R>::homogeneous(int i) const
|
PointH3<R>::homogeneous(int i) const
|
||||||
{
|
{
|
||||||
return get(base).homogeneous(i);
|
return base.homogeneous(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
|
|
@ -173,7 +171,7 @@ inline
|
||||||
typename PointH3<R>::FT
|
typename PointH3<R>::FT
|
||||||
PointH3<R>::operator[](int i) const
|
PointH3<R>::operator[](int i) const
|
||||||
{
|
{
|
||||||
return get(base)[i];
|
return base[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
|
|
@ -183,11 +181,11 @@ PointH3<R>::direction() const
|
||||||
{ return Direction_3(*this); }
|
{ return Direction_3(*this); }
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
CGAL_KERNEL_INLINE
|
inline
|
||||||
bool
|
bool
|
||||||
PointH3<R>::operator==( const PointH3<R> & p) const
|
PointH3<R>::operator==( const PointH3<R> & p) const
|
||||||
{
|
{
|
||||||
return get(base) == get(p.base);
|
return base == p.base;
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class R >
|
template < class R >
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue