Adding less-than operator (<) to Point_d

This commit is contained in:
Frédérik Paradis 2016-05-14 14:28:51 -04:00
parent 4af747178a
commit 35b3b09ab8
2 changed files with 40 additions and 0 deletions

View File

@ -241,6 +241,38 @@ the origin.
*/
bool operator==(const Origin&) ;
/*!
returns true iff `p` is lexicographically
smaller than `q` with respect to %Cartesian
lexicographic order of points.
\pre `p.dimension() == q.dimension()`.
*/
bool operator<(const Point_d<Kernel>& q);
/*!
returns true iff `p` is lexicographically
greater than `q` with respect to %Cartesian
lexicographic order of points.
\pre `p.dimension() == q.dimension()`.
*/
bool operator>(const Point_d<Kernel>& q);
/*!
returns true iff `p` is lexicographically
smaller than or equal to `q` with respect to %Cartesian
lexicographic order of points.
\pre `p.dimension() == q.dimension()`.
*/
bool operator<=(const Point_d<Kernel>& q);
/*!
returns true iff `p` is lexicographically
greater than or equal to `q` with respect to %Cartesian
lexicographic order of points.
\pre `p.dimension() == q.dimension()`.
*/
bool operator>=(const Point_d<Kernel>& q);
/// @}
}; /* end Point_d */

View File

@ -93,6 +93,14 @@ public:
Self& operator-=(const Vector_d<R>& v)
{ return static_cast<Self&>(Base::operator-=(v)); }
inline bool operator<(const Self& q) const
{ return R().less_lexicographically_d_object()(*this, q); }
inline bool operator>(const Self& q) const
{ return R().less_lexicographically_d_object()(q, *this); }
inline bool operator<=(const Self& q) const
{ return ! R().less_lexicographically_d_object()(q, *this); }
inline bool operator>=(const Self& q) const
{ return ! R().less_lexicographically_d_object()(*this, q); }
};
} //namespace CGAL