clray
view 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 |
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);
18 Vector3(const float *arr);
20 void normalize();
21 inline float length();
22 inline float lengthsq();
23 };
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);
28 inline Vector3 operator /(const Vector3 &a, const Vector3 &b);
30 inline Vector3 operator -(const Vector3 &vec);
31 inline Vector3 operator *(const Vector3 &vec, float s);
32 inline Vector3 operator /(const Vector3 &vec, float s);
34 inline float dot(const Vector3 &a, const Vector3 &b);
35 inline Vector3 cross(const Vector3 &a, const Vector3 &b);
37 inline Vector3 reflect(const Vector3 &v, const Vector3 &n);
39 #include "vector.inl"
41 #endif /* VECTOR_H_ */