summaryrefslogtreecommitdiff
path: root/vector.h
blob: a74fe8c33e1830fa4201d44374cf1c879380a425 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef _VECTOR_H_
#define _VECTOR_H_

class Vector2 {
	public:
		union {
			float x, r;
		};
		union {
			float y, g;
		};
		
		Vector2();
		Vector2(float p1, float p2);
		Vector2(const Vector2& v);
		
		Vector2& operator=(const Vector2& v);
		Vector2& operator+=(const Vector2& v);
		Vector2 operator+(const Vector2& v);
		Vector2& operator-=(const Vector2& v);
		Vector2 operator-(const Vector2& v);
};

class Vector3 : public Vector2 {
	public:
		union {
			float z, b;
		};
		
		Vector3();
		Vector3(float p1, float p2, float p3);
		Vector3(const Vector3& v);
		
		Vector3& operator=(const Vector3& v);
		Vector3& operator+=(const Vector3& v);
		Vector3 operator+(const Vector3& v);
		Vector3& operator-=(const Vector3& v);
		Vector3 operator-(const Vector3& v);
};

class Vector4 : public Vector3 {
	public:
		union {
			float w, a;
		};

		Vector4();
		Vector4(float p1, float p2, float p3, float p4);
		Vector4(const Vector4& v);

		Vector4& operator=(const Vector4& v);
		Vector4& operator+=(const Vector4& v);
		Vector4 operator+(const Vector4& v);
		Vector4& operator-=(const Vector4& v);
		Vector4 operator-(const Vector4& v);
};

#endif