10 Vec2(
float x,
float y);
14 Vec2 operator+(
const Vec2& other)
const;
15 Vec2 operator+(
float value);
17 Vec2& operator+=(
float value);
18 Vec2 operator-(
const Vec2& other)
const;
19 Vec2 operator-(
float value)
const;
20 Vec2 operator-()
const;
22 Vec2& operator-=(
float value);
23 bool operator==(
const Vec2& other)
const;
24 bool operator!=(
const Vec2& other)
const;
25 void operator=(
const Vec2& other);
26 void operator=(
float value);
27 Vec2 operator*(
float value)
const;
28 Vec2& operator*=(
float value);
29 Vec2 operator/(
float value)
const;
30 Vec2& operator/=(
float value);
82 static const Vec2 down;
83 static const Vec2 right;
84 static const Vec2 left;
85 static const Vec2 zero;
86 static const Vec2 one;
92inline Vec2 Vec2::operator+(
const Vec2& other)
const {
93 return Vec2(x + other.x, y + other.y);
96inline Vec2 Vec2::operator+(
float value) {
return Vec2(x + value, y + value); }
98inline Vec2& Vec2::operator+=(
const Vec2& other) {
104inline Vec2& Vec2::operator+=(
float value) {
110inline Vec2 Vec2::operator-(
const Vec2& other)
const {
111 return Vec2(x - other.x, y - other.y);
114inline Vec2 Vec2::operator-(
float value)
const {
115 return Vec2(x - value, y - value);
118inline Vec2 Vec2::operator-()
const {
return Vec2(-x, -y); }
120inline Vec2& Vec2::operator-=(
const Vec2& other) {
126inline Vec2& Vec2::operator-=(
float value) {
132inline bool Vec2::operator==(
const Vec2& value)
const {
133 if (x == value.x && y == value.y)
return true;
137inline bool Vec2::operator!=(
const Vec2& value)
const {
138 if (x == value.x && y == value.y)
return false;
142inline void Vec2::operator=(
const Vec2& other) {
147inline void Vec2::operator=(
float value) {
152inline Vec2 Vec2::operator*(
float value)
const {
153 return Vec2(x * value, y * value);
156inline Vec2& Vec2::operator*=(
float value) {
162inline Vec2 Vec2::operator/(
float value)
const {
163 return Vec2(x / value, y / value);
166inline Vec2& Vec2::operator/=(
float value) {
174inline void Vec2::Normalize() {
180 if (mag == 0)
return Vec2(0, 0);
181 return Vec2(x / mag, y / mag);
192 return (b - a).Magnitude();
198 return (b - a) * t + a;
202 return (b - a) * t + a;
represents mathematical vector with 2 components
Definition: vector_2.h:7
float Magnitude() const
Definition: vector_2.h:172
static float Radians(const Vec2 v)
Definition: vector_2.h:205
void Scale(const Vec2 scale)
Definition: vector_2.h:184
static float DotProduct(Vec2 a, Vec2 b)
Definition: vector_2.h:207
float SqrMagnitude() const
Definition: vector_2.h:189
static float Distance(const Vec2 a, const Vec2 b)
Definition: vector_2.h:191
Vec2 Normalized() const
Definition: vector_2.h:178
static Vec2 LerpUnclamped(const Vec2 a, const Vec2 b, float t)
Definition: vector_2.h:201
static Vec2 Lerp(const Vec2 a, const Vec2 b, float t)
Definition: vector_2.h:195
copperdielf Math Library
Definition: buffer.hpp:5