-
Notifications
You must be signed in to change notification settings - Fork 0
/
V4DEngine.cpp
72 lines (52 loc) · 1.53 KB
/
V4DEngine.cpp
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
//
// Created by Federico Bertossi on 10/07/21.
//
#include <iostream>
#include "V4DEngine.h"
namespace V4DEngine {
V4DEngine::V4DMath::V4DMath() : x(0.0), y(0.0), z(0.0) {}
V4DEngine::V4DMath::V4DMath(float uX, float uY, float uZ) : x(uX), y(uY), z(uZ) {}
V4DEngine::V4DMath::~V4DMath() = default;
V4DEngine::V4DMath::V4DMath(const V4DEngine::V4DMath &v) : x(v.x), y(v.y), z(v.z) {}
[[noreturn]] V4DMath &V4DMath::operator=(const V4DMath &v) {
x = v.x;
y = v.y;
z = v.z;
return *this;
}
void V4DEngine::V4DMath::operator+=(const V4DEngine::V4DMath &v) {
x += v.x;
y += v.y;
z += v.z;
}
V4DMath V4DMath::operator+(const V4DMath &v) const {
return V4DMath(x + v.x, y + v.y, z + v.z);
}
void V4DMath::operator-=(const V4DMath &v) {
x -= v.x;
y -= v.y;
z -= v.z;
}
V4DMath V4DMath::operator-(const V4DMath &v) const {
return V4DMath(x - v.x, y - v.y, z - v.z);
}
void V4DMath::operator*=(const float s) {
x *= s;
y *= s;
z *= s;
}
V4DMath V4DMath::operator*(float s) const {
return V4DMath(s * x, s * y, s * z);
}
void V4DMath::operator/=(float s) {
x = x / s;
y = y / s;
z = z / s;
}
V4DMath V4DMath::operator/(float s) const {
return V4DMath(x / s, y / s, z / s);
}
void V4DMath::show(const V4DMath &v) {
std::cout << "(" << v.x << "," << v.y << "," << v.z << ")" << std::endl;
}
}