5#include <nlohmann/json.hpp>
8#include <libultraship.h>
20 NLOHMANN_DEFINE_TYPE_INTRUSIVE(
RGBA8,
r,
g,
b,
a)
45 FVector operator*(
float scalar)
const {
46 return FVector(
x * scalar,
y * scalar,
z * scalar);
49 float Dot(
const FVector& other)
const {
50 return x * other.
x +
y * other.
y +
z * other.
z;
54 FVector Cross(
const FVector& other)
const {
56 y * other.
z -
z * other.
y,
57 z * other.
x -
x * other.
z,
58 x * other.
y -
y * other.
x
62 float Magnitude()
const {
63 return std::sqrt(
x *
x +
y *
y +
z *
z);
66 FVector Normalize()
const {
67 float len = std::sqrt(
x *
x +
y *
y +
z *
z);
70 x / len,
y / len,
z / len
73 return FVector(0, 0, 0);
76 float Square()
const {
77 return x *
x +
y *
y +
z *
z;
80 FVector() :
x(0),
y(0),
z(0) {}
81 FVector(
float x,
float y,
float z) :
x(
x),
y(
y),
z(
z) {}
82 NLOHMANN_DEFINE_TYPE_INTRUSIVE(FVector,
x,
y,
z)
113 FVector2D(
float x,
float z) :
x(
x),
z(
z) {}
114 NLOHMANN_DEFINE_TYPE_INTRUSIVE(FVector2D,
x,
z)
154 [[nodiscard]]
void Set(uint16_t p, uint16_t y, uint16_t r) {
161 IRotator(
float p,
float y,
float r) {
162 pitch = p * (UINT16_MAX / 360);
163 yaw = y * (UINT16_MAX / 360);
164 roll = r * (UINT16_MAX / 360);
168 [[nodiscard]] FVector ToRadians()
const {
169 float scale = 2.0f *
M_PI / 65536.0f;
196 [[nodiscard]]
IRotator ToBinary()
const {
198 static_cast<uint16_t
>(
pitch * (UINT16_MAX / 360)),
199 static_cast<uint16_t
>(
yaw * (UINT16_MAX / 360)),
200 static_cast<uint16_t
>(
roll * (UINT16_MAX / 360))
205 FRotator(
float p,
float y,
float r) :
pitch(p),
yaw(y),
roll(r) {}
206 FRotator(IRotator rot) {
207 pitch =
static_cast<float>(rot.
pitch * (360 / UINT16_MAX));
208 yaw =
static_cast<float>(rot.
yaw * (360 / UINT16_MAX));
209 roll =
static_cast<float>(rot.
roll * (360 / UINT16_MAX));
231 IPathSpan& operator=(
const IPathSpan& Other) {
232 if (
this != &Other) {
240 bool operator==(
const IPathSpan& Other)
const {
245 bool operator!=(
const IPathSpan& Other)
const {
246 return !(*
this == Other);
struct IVector2D IVector2D
#define M_PI
Definition matrix.h:30
bool operator==(Color_RGB8 const &l, Color_RGB8 const &r) noexcept
Definition Menu.cpp:29
Definition CoreMath.h:184
float yaw
Definition CoreMath.h:185
float roll
Definition CoreMath.h:185
float pitch
Definition CoreMath.h:185
Definition CoreMath.h:102
float x
Definition CoreMath.h:103
float z
Definition CoreMath.h:103
float y
Definition CoreMath.h:87
float w
Definition CoreMath.h:87
float z
Definition CoreMath.h:87
float x
Definition CoreMath.h:87
float x
Definition CoreMath.h:31
float z
Definition CoreMath.h:31
float y
Definition CoreMath.h:31
Definition CoreMath.h:218
int32_t Start
Definition CoreMath.h:219
int32_t End
Definition CoreMath.h:219
Definition CoreMath.h:141
uint16_t roll
Definition CoreMath.h:142
uint16_t yaw
Definition CoreMath.h:142
uint16_t pitch
Definition CoreMath.h:142
Definition CoreMath.h:119
int32_t Y
Definition CoreMath.h:120
int32_t X
Definition CoreMath.h:120
uint8_t g
Definition CoreMath.h:18
uint8_t a
Definition CoreMath.h:18
uint8_t r
Definition CoreMath.h:18
uint8_t b
Definition CoreMath.h:18