forked from donovan6000/iMe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vector.h
executable file
·52 lines (37 loc) · 1.1 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
// Header guard
#ifndef VECTOR_H
#define VECTOR_H
// Vector class
class Vector final {
// Public
public:
// Initialize
void initialize(float x = 0, float y = 0, float z = 0, float e = 0) noexcept;
// Get Length
float getLength() const noexcept;
// Normalize
void normalize() noexcept;
// Addition operator
Vector operator+(const Vector &addend) const noexcept;
Vector &operator+=(const Vector &addend) noexcept;
// Subtraction operator
Vector operator-(const Vector &subtrahend) const noexcept;
Vector &operator-=(const Vector &subtrahend) noexcept;
// Multiplication operator
Vector operator*(float multiplier) const noexcept;
Vector &operator*=(float multiplier) noexcept;
// Division operator
Vector operator/(float divisor) const noexcept;
Vector &operator/=(float divisor) noexcept;
// Subscript operator
const float& operator[](int index) const noexcept;
float& operator[](int index) noexcept;
// Assignment operator
Vector &operator=(const Vector &vector) noexcept;
// Vector components
float x;
float y;
float z;
float e;
};
#endif