31#ifndef LIB2GEOM_SEEN_INT_POINT_H
32#define LIB2GEOM_SEEN_INT_POINT_H
36#include <boost/functional/hash.hpp>
37#include <boost/operators.hpp>
52 : boost::additive< IntPoint
53 , boost::totally_ordered< IntPoint
54 , boost::multiplicative< IntPoint, IntCoord
55 , boost::multiplicative< IntPoint
83 template <
size_t I>
constexpr IntCoord get()
const {
static_assert(I < 2);
return _pt[I]; }
84 template <
size_t I>
constexpr IntCoord &
get() {
static_assert(I < 2);
return _pt[I]; }
180 return a[
X] < b[
X] || (a[
X] == b[
X] && a[
Y] < b[
Y]);
185 return a[
Y] < b[
Y] || (a[
Y] == b[
Y] && a[
X] < b[
X]);
190 return a[
X] > b[
X] || (a[
X] == b[
X] && a[
Y] > b[
Y]);
195 return a[
Y] > b[
Y] || (a[
Y] == b[
Y] && a[
X] > b[
X]);
208template <>
struct std::tuple_size<
Geom::IntPoint> : std::integral_constant<size_t, 2> {};
212template <>
struct std::hash<
Geom::IntPoint>
216 boost::hash_combine(hash, p.x());
217 boost::hash_combine(hash, p.y());
Two-dimensional point with integer coordinates.
constexpr IntPoint()=default
Construct a point at the origin.
constexpr IntPoint ccw() const
Return a point like this point but rotated -90 degrees.
constexpr IntPoint & operator*=(IntPoint const &o)
constexpr IntPoint & operator/=(IntPoint const &o)
constexpr IntPoint operator-() const
constexpr IntCoord & operator[](Dim2 d)
constexpr IntCoord get() const
constexpr bool operator<(IntPoint const &p) const
Lexicographical ordering for points.
constexpr bool operator==(IntPoint const &p) const
Equality operator.
constexpr IntPoint(IntCoord x, IntCoord y)
Construct a point from its coordinates.
constexpr IntCoord & x() noexcept
IntCoord & operator[](unsigned i)
constexpr IntPoint & operator/=(IntCoord o)
constexpr IntCoord & get()
constexpr IntPoint & operator-=(IntPoint const &o)
constexpr IntCoord x() const noexcept
constexpr IntCoord & y() noexcept
IntCoord operator[](unsigned i) const
constexpr IntCoord y() const noexcept
constexpr IntCoord lengthSq() const
constexpr IntPoint & operator*=(IntCoord o)
constexpr IntPoint & operator+=(IntPoint const &o)
constexpr IntCoord operator[](Dim2 d) const
constexpr IntPoint cw() const
Return a point like this point but rotated +90 degrees.
Integral and real coordinate types and some basic utilities.
Dim2
2D axis enumeration (X or Y).
int IntCoord
Type used for integral coordinates.
Various utility functions.
Lexicographical ordering functor with runtime dimension.
bool operator()(IntPoint const &a, IntPoint const &b) const
bool operator()(IntPoint const &a, IntPoint const &b) const
bool operator()(IntPoint const &a, IntPoint const &b) const
Lexicographical ordering functor.
Lexicographical ordering functor with runtime dimension.
bool operator()(IntPoint const &a, IntPoint const &b) const
bool operator()(IntPoint const &a, IntPoint const &b) const
bool operator()(IntPoint const &a, IntPoint const &b) const
Lexicographical ordering functor.
size_t operator()(Geom::IntPoint const &p) const noexcept