volmetrics
view src/vector.h @ 13:77a376198d38
foo
author | Eleni Maria Stea <elene.mst@gmail.com> |
---|---|
date | Sun, 02 Feb 2014 02:32:00 +0200 |
parents | |
children |
line source
1 #ifndef VECTOR_H_
2 #define VECTOR_H_
4 class Matrix4x4;
6 class Vector3 {
7 public:
8 float x,y,z;
9 Vector3();
10 Vector3(float x, float y, float z);
11 void transform(const Matrix4x4 &tm);
12 void printv();
13 };
15 bool operator < (const Vector3 &a, const Vector3 &b);
16 bool operator > (const Vector3 &a, const Vector3 &b);
17 bool operator == (const Vector3 &a, const Vector3 &b);
19 Vector3 operator + (const Vector3 &a, const Vector3 &b);
20 Vector3 operator - (const Vector3 &a, const Vector3 &b);
21 Vector3 operator - (const Vector3 &a);
22 Vector3 operator * (const Vector3 &a, const Vector3 &b);
23 Vector3 operator * (const Vector3 &a, float b);
24 Vector3 operator * (float b, const Vector3 &a);
25 Vector3 operator / (const Vector3 &a, float b);
27 const Vector3 &operator += (Vector3 &a, const Vector3 &b);
29 float length (const Vector3 &a);
30 float dot (const Vector3 &a, const Vector3 &b);
31 Vector3 cross (const Vector3 &a, const Vector3 &b);
32 Vector3 normalize (const Vector3 &a);
34 Vector3 reflect(const Vector3 &v, const Vector3 &n);
36 class Vector4 {
37 public:
38 float x, y, z, w;
39 Vector4();
40 Vector4(float x, float y, float z, float w);
41 void transform(const Matrix4x4 &tm);
42 void printv();
43 };
45 bool operator < (const Vector4 &a, const Vector4 &b);
46 bool operator > (const Vector4 &a, const Vector4 &b);
47 bool operator == (const Vector4 &a, const Vector4 &b);
49 Vector4 operator + (const Vector4 &a, const Vector4 &b);
50 Vector4 operator - (const Vector4 &a, const Vector4 &b);
51 Vector4 operator - (const Vector4 &a);
52 Vector4 operator * (const Vector4 &a, const Vector4 &b);
53 Vector4 operator * (const Vector4 &a, float b);
54 Vector4 operator * (float b, const Vector4 &a);
55 Vector4 operator / (const Vector4 &a, float b);
57 const Vector4 &operator += (Vector4 &a, const Vector4 &b);
59 float length (const Vector4 &a);
60 float dot (const Vector4 &a, const Vector4 &b);
61 Vector4 cross (const Vector4 &v1, const Vector4 &v2, const Vector4 &v3);
62 Vector4 normalize (const Vector4 &a);
64 Vector4 reflect(const Vector4 &v, const Vector4 &n);
67 #endif