annotate src/vector.h @ 58:3d13924b22e6
implementing polygon split
author |
John Tsiombikas <nuclear@member.fsf.org> |
date |
Sun, 12 Sep 2010 00:19:04 +0100 |
parents |
51f115e337c2 |
children |
|
rev |
line source |
nuclear@23
|
1 #ifndef VECTOR_H_
|
nuclear@23
|
2 #define VECTOR_H_
|
nuclear@23
|
3
|
nuclear@23
|
4 class Vector2 {
|
nuclear@23
|
5 public:
|
nuclear@23
|
6 float x, y;
|
nuclear@23
|
7
|
nuclear@23
|
8 Vector2();
|
nuclear@23
|
9 Vector2(float x, float y);
|
nuclear@23
|
10 };
|
nuclear@23
|
11
|
nuclear@23
|
12 class Vector3 {
|
nuclear@23
|
13 public:
|
nuclear@23
|
14 float x, y, z;
|
nuclear@23
|
15
|
nuclear@23
|
16 Vector3();
|
nuclear@23
|
17 Vector3(float x, float y, float z);
|
nuclear@54
|
18 Vector3(const float *arr);
|
nuclear@23
|
19
|
nuclear@23
|
20 void normalize();
|
nuclear@23
|
21 inline float length();
|
nuclear@23
|
22 inline float lengthsq();
|
nuclear@23
|
23 };
|
nuclear@23
|
24
|
nuclear@23
|
25 inline Vector3 operator +(const Vector3 &a, const Vector3 &b);
|
nuclear@23
|
26 inline Vector3 operator -(const Vector3 &a, const Vector3 &b);
|
nuclear@23
|
27 inline Vector3 operator *(const Vector3 &a, const Vector3 &b);
|
nuclear@23
|
28 inline Vector3 operator /(const Vector3 &a, const Vector3 &b);
|
nuclear@23
|
29
|
nuclear@23
|
30 inline Vector3 operator -(const Vector3 &vec);
|
nuclear@23
|
31 inline Vector3 operator *(const Vector3 &vec, float s);
|
nuclear@54
|
32 inline Vector3 operator /(const Vector3 &vec, float s);
|
nuclear@23
|
33
|
nuclear@23
|
34 inline float dot(const Vector3 &a, const Vector3 &b);
|
nuclear@23
|
35 inline Vector3 cross(const Vector3 &a, const Vector3 &b);
|
nuclear@23
|
36
|
nuclear@54
|
37 inline Vector3 reflect(const Vector3 &v, const Vector3 &n);
|
nuclear@54
|
38
|
nuclear@23
|
39 #include "vector.inl"
|
nuclear@23
|
40
|
nuclear@23
|
41 #endif /* VECTOR_H_ */
|