-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathVector2.h
46 lines (39 loc) · 1.05 KB
/
Vector2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef VECTOR2_H_
#define VECTOR2_H_
namespace Engine
{
struct Vector2
{
public:
union
{
struct
{
float X;
float Y;
};
float XY[2];
};
Vector2(void);
Vector2(float x, float y);
float GetLength(void) const;
float GetLengthSquared(void) const;
void Normalize(void);
Vector2 operator+(const Vector2 &other) const;
Vector2 operator+=(const Vector2 &other);
Vector2 operator-(const Vector2 &other) const;
Vector2 operator-=(const Vector2 &other);
Vector2 operator*(float scalar) const;
Vector2 operator*=(float scalar);
float operator*(const Vector2 &other) const;
bool operator<(const Vector2 &other) const;
bool operator<=(const Vector2 &other) const;
bool operator>(const Vector2 &other) const;
bool operator>=(const Vector2 &other) const;
bool operator==(const Vector2 &other) const;
bool operator!=(const Vector2 &other) const;
static float Dot(const Vector2 &left, const Vector2 &right);
static Vector2 Normalize(const Vector2 &vector);
};
}
#endif