clray
view src/vector.h @ 48:154f03802aea
forgot to add common.h to the repository
author | John Tsiombikas |
---|---|
date | Tue, 31 Aug 2010 01:03:46 +0100 |
parents | |
children | 6a30f27fa1e6 |
line source
1 #ifndef VECTOR_H_
2 #define VECTOR_H_
4 class Vector2 {
5 public:
6 float x, y;
8 Vector2();
9 Vector2(float x, float y);
10 };
12 class Vector3 {
13 public:
14 float x, y, z;
16 Vector3();
17 Vector3(float x, float y, float z);
19 void normalize();
20 inline float length();
21 inline float lengthsq();
22 };
24 inline Vector3 operator +(const Vector3 &a, const Vector3 &b);
25 inline Vector3 operator -(const Vector3 &a, const Vector3 &b);
26 inline Vector3 operator *(const Vector3 &a, const Vector3 &b);
27 inline Vector3 operator /(const Vector3 &a, const Vector3 &b);
29 inline Vector3 operator -(const Vector3 &vec);
30 inline Vector3 operator *(const Vector3 &vec, float s);
32 inline float dot(const Vector3 &a, const Vector3 &b);
33 inline Vector3 cross(const Vector3 &a, const Vector3 &b);
35 #include "vector.inl"
37 #endif /* VECTOR_H_ */