17#ifndef MIR_GEOMETRY_DISPLACEMENT_H_
18#define MIR_GEOMETRY_DISPLACEMENT_H_
53 template<
typename DeltaXType,
typename DeltaYType>
56 template <
typename Q = T>
57 constexpr typename std::enable_if<std::is_integral<Q>::value,
long long>::type
length_squared()
const
59 long long x =
dx.as_value(), y =
dy.as_value();
63 template <
typename Q = T>
64 constexpr typename std::enable_if<!std::is_integral<Q>::value, T>::type
length_squared()
const
66 T x =
dx.as_value(), y =
dy.as_value();
77 return lhs.
dx == rhs.
dx && lhs.
dy == rhs.
dy;
83 return lhs.
dx != rhs.
dx || lhs.
dy != rhs.
dy;
89 out <<
'(' << value.
dx <<
", " << value.
dy <<
')';
138 return lhs = lhs + rhs;
144 return lhs = lhs - rhs;
153template<
typename T,
typename Scalar>
159template<
typename T,
typename Scalar>
174 return Size<T>{disp.
dx.as_value(), disp.
dy.as_value()};
186 return Point<T>{disp.
dx.as_value(), disp.
dy.as_value()};
DeltaX< T > & operator-=(DeltaX< T > &lhs, DeltaX< T > rhs)
Definition dimensions.h:142
std::ostream & operator<<(std::ostream &out, Value< T, Tag > const &value)
Definition dimensions.h:118
constexpr bool operator==(Displacement< T > const &lhs, Displacement< T > const &rhs)
Definition displacement.h:75
bool operator<(Displacement< T > const &lhs, Displacement< T > const &rhs)
Definition displacement.h:148
constexpr DeltaX< T > operator+(DeltaX< T > lhs, DeltaX< T > rhs)
Definition dimensions.h:126
constexpr Displacement< T > as_displacement(Size< T > const &size)
Definition displacement.h:166
DeltaX< T > & operator+=(DeltaX< T > &lhs, DeltaX< T > rhs)
Definition dimensions.h:138
constexpr Width< T > operator*(Scalar scale, Width< T > const &w)
Definition dimensions.h:206
constexpr Size< T > as_size(Displacement< T > const &disp)
Definition displacement.h:172
constexpr DeltaX< T > operator-(DeltaX< T > lhs, DeltaX< T > rhs)
Definition dimensions.h:130
constexpr bool operator!=(Displacement< T > const &lhs, Displacement< T > const &rhs)
Definition displacement.h:81
constexpr Point< T > as_point(Displacement< T > const &disp)
Definition displacement.h:184
generic::Point< int > Point
Definition forward.h:81
generic::Size< int > Size
Definition forward.h:82
Definition splash_session.h:22
Definition displacement.h:39
constexpr Displacement(Displacement< U > const &other) noexcept
Definition displacement.h:47
Displacement & operator=(Displacement const &)=default
DeltaX< T > dx
Definition displacement.h:70
DeltaY< T > dy
Definition displacement.h:71
T ValueType
Definition displacement.h:40
constexpr Displacement(Displacement const &)=default
constexpr std::enable_if<!std::is_integral< Q >::value, T >::type length_squared() const
Definition displacement.h:64
constexpr Displacement()
Definition displacement.h:42
constexpr std::enable_if< std::is_integral< Q >::value, longlong >::type length_squared() const
Definition displacement.h:57
constexpr Displacement(DeltaXType &&dx, DeltaYType &&dy)
Definition displacement.h:54
X< T > x
Definition point.h:54
Y< T > y
Definition point.h:55
Height< T > height
Definition size.h:55
Width< T > width
Definition size.h:54
Wraps a geometry value and prevents it from being accidentally used for invalid operations (such as s...
Definition dimensions.h:37