volmetrics

annotate src/vector.h @ 23:930c063ae346

preview works - transfer function on sdr
author Eleni Maria Stea <elene.mst@gmail.com>
date Thu, 24 Apr 2014 21:32:28 +0300
parents
children
rev   line source
eleni@0 1 #ifndef VECTOR_H_
eleni@0 2 #define VECTOR_H_
eleni@0 3
eleni@0 4 class Matrix4x4;
eleni@0 5
eleni@0 6 class Vector3 {
eleni@0 7 public:
eleni@0 8 float x,y,z;
eleni@0 9 Vector3();
eleni@0 10 Vector3(float x, float y, float z);
eleni@0 11 void transform(const Matrix4x4 &tm);
eleni@0 12 void printv();
eleni@0 13 };
eleni@0 14
eleni@0 15 bool operator < (const Vector3 &a, const Vector3 &b);
eleni@0 16 bool operator > (const Vector3 &a, const Vector3 &b);
eleni@0 17 bool operator == (const Vector3 &a, const Vector3 &b);
eleni@0 18
eleni@0 19 Vector3 operator + (const Vector3 &a, const Vector3 &b);
eleni@0 20 Vector3 operator - (const Vector3 &a, const Vector3 &b);
eleni@0 21 Vector3 operator - (const Vector3 &a);
eleni@0 22 Vector3 operator * (const Vector3 &a, const Vector3 &b);
eleni@0 23 Vector3 operator * (const Vector3 &a, float b);
eleni@0 24 Vector3 operator * (float b, const Vector3 &a);
eleni@0 25 Vector3 operator / (const Vector3 &a, float b);
eleni@0 26
eleni@0 27 const Vector3 &operator += (Vector3 &a, const Vector3 &b);
eleni@0 28
eleni@0 29 float length (const Vector3 &a);
eleni@0 30 float dot (const Vector3 &a, const Vector3 &b);
eleni@0 31 Vector3 cross (const Vector3 &a, const Vector3 &b);
eleni@0 32 Vector3 normalize (const Vector3 &a);
eleni@0 33
eleni@0 34 Vector3 reflect(const Vector3 &v, const Vector3 &n);
eleni@0 35
eleni@0 36 class Vector4 {
eleni@0 37 public:
eleni@0 38 float x, y, z, w;
eleni@0 39 Vector4();
eleni@0 40 Vector4(float x, float y, float z, float w);
eleni@0 41 void transform(const Matrix4x4 &tm);
eleni@0 42 void printv();
eleni@0 43 };
eleni@0 44
eleni@0 45 bool operator < (const Vector4 &a, const Vector4 &b);
eleni@0 46 bool operator > (const Vector4 &a, const Vector4 &b);
eleni@0 47 bool operator == (const Vector4 &a, const Vector4 &b);
eleni@0 48
eleni@0 49 Vector4 operator + (const Vector4 &a, const Vector4 &b);
eleni@0 50 Vector4 operator - (const Vector4 &a, const Vector4 &b);
eleni@0 51 Vector4 operator - (const Vector4 &a);
eleni@0 52 Vector4 operator * (const Vector4 &a, const Vector4 &b);
eleni@0 53 Vector4 operator * (const Vector4 &a, float b);
eleni@0 54 Vector4 operator * (float b, const Vector4 &a);
eleni@0 55 Vector4 operator / (const Vector4 &a, float b);
eleni@0 56
eleni@0 57 const Vector4 &operator += (Vector4 &a, const Vector4 &b);
eleni@0 58
eleni@0 59 float length (const Vector4 &a);
eleni@0 60 float dot (const Vector4 &a, const Vector4 &b);
eleni@0 61 Vector4 cross (const Vector4 &v1, const Vector4 &v2, const Vector4 &v3);
eleni@0 62 Vector4 normalize (const Vector4 &a);
eleni@0 63
eleni@0 64 Vector4 reflect(const Vector4 &v, const Vector4 &n);
eleni@0 65
eleni@0 66
eleni@0 67 #endif
eleni@0 68