Skip to content

Commit

Permalink
Adding less-than operator (<) to Point_d
Browse files Browse the repository at this point in the history
  • Loading branch information
freud14 committed May 14, 2016
1 parent 4af7471 commit 35b3b09
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Point_d.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
8 changes: 8 additions & 0 deletions Kernel_d/include/CGAL/Kernel_d/Point_d.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ class Point_d : public pR::Point_d_base
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
Expand Down

0 comments on commit 35b3b09

Please sign in to comment.