39 return (X - other.X) * (X - other.X) + (Y - other.Y) * (Y - other.Y);
51 auto AsTuple() const -> std::tuple<T, T>
53 return std::make_tuple(X, Y);
70 explicit operator std::string()
78 friend auto operator<<(std::ostream&,
const Vec2<U>&) -> std::ostream&;
79 template <
typename R,
typename U>
81 template <
typename R,
typename U>
88using Vec2f = Vec2<float>;
89using Vec2d = Vec2<double>;
90using Vec2i = Vec2<int32_t>;
91using Vec2ui = Vec2<uint32_t>;
93template <
typename T,
typename U>
94auto operator*(
const Vec2<T>& vec,
const U& value) -> Vec2<T>
96 return { vec.X *
static_cast<T
>(value), vec.Y *
static_cast<T
>(value) };
98template <
typename T,
typename U>
99auto operator*(
const U& value,
const Vec2<T>& vec) -> Vec2<T>
101 return { vec.X *
static_cast<T
>(value), vec.Y *
static_cast<T
>(value) };
105auto operator<<(std::ostream& out,
const Vec2<U>& v) -> std::ostream&
107 return out <<
"Vec2<" <<
typeid(U).name() <<
">(" << v.X <<
"," << v.Y
Utility Vec2 class with x, y coordinates.
Definition Vec2.hpp:16
auto DistToSquared(const Vec2< U > &other)
returns distance^2 to other point
Definition Vec2.hpp:37
auto DistTo(const Vec2< U > &other)
returns distance to other point
Definition Vec2.hpp:46
Vec2()
creates Vec2 with 0, 0 coordinates
Definition Vec2.hpp:21
Definition CanvasLib.hpp:44