-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVector4.h
73 lines (56 loc) · 1.22 KB
/
Vector4.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef VECTOR4_H
#define VECTOR4_H
#include "Vector3.h"
class Vector4 : public Vector3{
private: double _w;
public: Vector4(double x,double y,double z,double w): Vector3(x,y,z){
_w = w;
}
public: Vector4(){}
public: ~Vector4(){}
public: double getW(){
return _w;
}
public: double setW(double w){
_w = w;
}
public: void set(double x, double y, double z, double w){
_x = x;
_y = y;
_z = z;
_w = w;
}
Vector4 operator+(const Vector4& vec){
Vector4 res;
res._x = this->getX() + vec._x;
res._y = this->getY() + vec._y;
res._z = this->getZ() + vec._z;
res._w = this->getW() + vec._w;
return res;
}
Vector4 operator-(const Vector4& vec){
Vector4 res;
res._x = this->getX() - vec._x;
res._y = this->getY() - vec._y;
res._z = this->getZ() - vec._z;
res._w = this->getW() - vec._w;
return res;
}
Vector4 operator*(double multiplier){
Vector4 res;
res._x = this->getX() * multiplier;
res._y = this->getY() * multiplier;
res._z = this->getZ() * multiplier;
res._w = this->getW() * multiplier;
return res;
}
Vector4 operator=(const Vector4& vec){
Vector4 res;
this->setX(vec._x);
this->setY(vec._y);
this->setZ(vec._z);
this->_w = vec._w;
return res;
}
};
#endif