7#include <boost/qvm_lite.hpp>
10#if __has_include(<format>) && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 170000)
57 template <
class Archive>
void serialize(Archive& ar,
const unsigned int) {
67#if __has_include(<format>) && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 170000)
79template <>
struct vec_traits<
jngl::Vec2> {
80 static int const dim = 2;
81 using scalar_type = double;
83 template <
int I>
static scalar_type& write_element(
jngl::Vec2& v) {
86 template <
int I>
static scalar_type read_element(
const jngl::Vec2& v) {
90 static scalar_type& write_element_idx(
int i,
jngl::Vec2& v) {
93 static scalar_type read_element_idx(
int i,
jngl::Vec2 const& v) {
100using boost::qvm::operator+=;
101using boost::qvm::operator*=;
102using boost::qvm::operator/=;
103using boost::qvm::operator-=;
104using boost::qvm::operator==;
105using boost::qvm::operator!=;
106using boost::qvm::operator+;
107using boost::qvm::operator-;
108using boost::qvm::operator/;
109using boost::qvm::operator*;
void rotate(float angle)
rotates the vector clock-wise by angle (radian)
bool isNull() const
returns true if both x and y are exactly 0
Vec2(double x, double y)
Creates a vector {x, y}.
void serialize(Archive &ar, const unsigned int)
Helper function to use with cereal or Boost.Serialization.
std::ostream & operator<<(std::ostream &, const Vec2 &)
Prints the vector like this: [x=…, y=…].