13#ifdef MATH_SILENCE_WARNING
15 #pragma GCC diagnostic push
16 #pragma GCC diagnostic ignored "-Wpedantic"
18 #pragma clang diagnostic push
19 #pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
20 #pragma clang diagnostic ignored "-Wnested-anon-types"
23 #pragma warning(disable : 4201)
33#ifdef MATH_SILENCE_WARNING
35 #pragma clang diagnostic pop
37 #pragma GCC diagnostic pop
50 x =
static_cast<T
>(0.0f);
51 y =
static_cast<T
>(0.0f);
58 vec2(
const T& _x,
const T& _y) {
67 explicit vec2(
const T& _v) {
86 inline float length()
const {
return sqrtf(
x *
x +
y *
y); }
205 this->
x =
static_cast<T
>(V.
x);
206 this->
y =
static_cast<T
>(V.
y);
261 os << obj.
x <<
", " << obj.
y << std::endl;
274 return vec2<T>(values[0], values[1]);
vec2< T > & operator+=(const vec2< T > &rhs)
Definition: vec2.h:147
friend vec2< T > operator/(const vec2< T > &lhs, vec2< T > rhs)
Definition: vec2.h:123
vec2< T > & operator/=(const T &rhs)
Definition: vec2.h:177
friend T operator*(vec2< T > lhs, const vec2< T > &rhs)
Definition: vec2.h:131
vec2< T > & operator*=(const T &rhs)
Definition: vec2.h:167
vec2< T > normalize() const
Definition: vec2.h:91
vec2()
Definition: vec2.h:49
const T & operator[](const int &index) const
Definition: vec2.h:228
vec2(const vec2< T > &_v)
Definition: vec2.h:76
friend vec2< T > operator+(vec2< T > lhs, const vec2< T > &rhs)
Definition: vec2.h:100
constexpr vec2< T > & operator=(vec2< T > const &V)
Definition: vec2.h:204
friend bool operator==(const vec2< T > &lhs, const vec2< T > &rhs)
Definition: vec2.h:196
vec2< T > & operator/=(const vec2< T > &rhs)
Definition: vec2.h:182
friend vec2< T > operator*(const T &lhs, vec2< T > rhs)
Definition: vec2.h:121
float length() const
Definition: vec2.h:86
const size_t dim
object dimension
Definition: vec2.h:44
friend vec2< T > operator-(vec2< T > lhs, const vec2< T > &rhs)
Definition: vec2.h:107
friend std::ostream & operator<<(std::ostream &, const vec2< U > &)
vec2< T > & operator-=(const vec2< T > &rhs)
Definition: vec2.h:157
T & operator[](const int &index)
Definition: vec2.h:216
vec2(const T &_x, const T &_y)
Definition: vec2.h:58
friend vec2< T > operator*(vec2< T > lhs, const T &rhs)
Definition: vec2.h:114
vec2(const T &_v)
Definition: vec2.h:67
friend vec2< T > operator/(vec2< T > lhs, const T &rhs)
Definition: vec2.h:139
vec2< T > build_vec2(void *in)
Definition: vec2.h:272
std::ostream & operator<<(std::ostream &os, const vec2< T > &obj)
Definition: vec2.h:259