-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vector.h
57 lines (34 loc) · 1.16 KB
/
Vector.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*----------------------------------------------------------
* COSC363 Ray Tracer
*
* The vector class
* Use this class for defining vectors and points
* and for performing operations on them.
-------------------------------------------------------------*/
#ifndef H_VECTOR
#define H_VECTOR
class Vector
{
public:
float x, y, z;
Vector();
Vector(float a_x, float a_y, float a_z);
const Vector& operator*=(float scale);
Vector operator*(float scale) const;
const Vector& operator/=(float scale);
Vector operator/(float scale) const;
const Vector& operator+=(const Vector rhs);
Vector operator+(const Vector rhs) const;
const Vector& operator-=(const Vector rhs);
Vector operator-(const Vector rhs) const;
const bool operator==(const Vector rhs);
const bool operator!=(const Vector rhs);
const bool operator<(const Vector rhs);
void scale(float scale);
Vector cross(const Vector rhs) const;
float dot(const Vector rhs) const;
float dist(const Vector rhs) const;
float length() const;
void normalise();
};
#endif //!H_VECTOR