forked from cazzwastaken/external-aimbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvector.h
41 lines (33 loc) · 1.07 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
#pragma once
#include <cmath>
#include <numbers>
struct Vector3 {
// constructor
Vector3(const float x = 0.f, const float y = 0.f,
const float z = 0.f) noexcept
: x(x), y(y), z(z) {}
// operator overloads
const Vector3 operator-(const Vector3 &other) const noexcept {
return Vector3{x - other.x, y - other.y, z - other.z};
}
const Vector3 operator+(const Vector3 &other) const noexcept {
return Vector3{x + other.x, y + other.y, z + other.z};
}
const Vector3 operator/(const float factor) const noexcept {
return Vector3{x / factor, y / factor, z / factor};
}
const Vector3 operator*(const float factor) const noexcept {
return Vector3{x * factor, y * factor, z * factor};
}
// utils
const Vector3 ToAngle() const noexcept {
return Vector3{
std::atan2(-z, std::hypot(x, y)) * (180.0f / std::numbers::pi_v<float>),
std::atan2(y, x) * (180.0f / std::numbers::pi_v<float>), 0.0f};
}
const bool IsZero() const noexcept {
return x == 0.f && y == 0.f && z == 0.f;
}
// struct data
float x, y, z;
};