2019-05-10 05:17:29 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
template<typename T> struct Coordinates {
|
|
|
|
Coordinates(T _x, T _y) : x(_x), y(_y) {}
|
|
|
|
T x;
|
|
|
|
T y;
|
|
|
|
};
|
|
|
|
|
2022-06-11 09:02:27 +00:00
|
|
|
struct VirtualCoordinates: Coordinates<uint8_t> {
|
|
|
|
VirtualCoordinates(uint8_t _x, uint8_t _y) : Coordinates(_x, _y) {}
|
2019-05-10 05:17:29 +00:00
|
|
|
};
|
|
|
|
|
2021-03-29 08:10:55 +00:00
|
|
|
struct PhysicalCoordinates: Coordinates<uint16_t> {
|
|
|
|
PhysicalCoordinates(uint16_t _x, uint16_t _y) : Coordinates(_x, _y) {}
|
2019-05-10 05:17:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T> struct Vector3d {
|
|
|
|
Vector3d(T _x, T _y, T _z) : x(_x), y(_y), z(_z) {}
|
|
|
|
Vector3d() : Vector3d(0, 0, 0) {}
|
|
|
|
T x;
|
|
|
|
T y;
|
|
|
|
T z;
|
|
|
|
|
|
|
|
T magnitude() const {
|
|
|
|
return abs(max(x, max(y, z)));
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector3d<T> operator-(const Vector3d<T>& other) const {
|
|
|
|
return Vector3d<T>(x - other.x, y - other.y, z - other.z);
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector3d<T> absolute() const {
|
|
|
|
return Vector3d<T>(abs(x), abs(y), abs(z));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef Vector3d<uint8_t> Vec3;
|