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 FVector() :
x(0),
y(0),
z(0) {}
77 FVector(
float x,
float y,
float z) :
x(
x),
y(
y),
z(
z) {}
78 NLOHMANN_DEFINE_TYPE_INTRUSIVE(FVector,
x,
y,
z)
109 FVector2D(
float x,
float z) :
x(
x),
z(
z) {}
110 NLOHMANN_DEFINE_TYPE_INTRUSIVE(FVector2D,
x,
z)
150 [[nodiscard]]
void Set(uint16_t p, uint16_t y, uint16_t r) {
157 IRotator(
float p,
float y,
float r) {
158 pitch = p * (UINT16_MAX / 360);
159 yaw = y * (UINT16_MAX / 360);
160 roll = r * (UINT16_MAX / 360);
164 [[nodiscard]] FVector ToRadians()
const {
165 float scale = 2.0f *
M_PI / 65536.0f;
192 [[nodiscard]]
IRotator ToBinary()
const {
194 static_cast<uint16_t
>(
pitch * (UINT16_MAX / 360)),
195 static_cast<uint16_t
>(
yaw * (UINT16_MAX / 360)),
196 static_cast<uint16_t
>(
roll * (UINT16_MAX / 360))
201 FRotator(
float p,
float y,
float r) :
pitch(p),
yaw(y),
roll(r) {}
202 FRotator(IRotator rot) {
203 pitch =
static_cast<float>(rot.
pitch * (360 / UINT16_MAX));
204 yaw =
static_cast<float>(rot.
yaw * (360 / UINT16_MAX));
205 roll =
static_cast<float>(rot.
roll * (360 / UINT16_MAX));
227 IPathSpan& operator=(
const IPathSpan& Other) {
228 if (
this != &Other) {
236 bool operator==(
const IPathSpan& Other)
const {
241 bool operator!=(
const IPathSpan& Other)
const {
242 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:180
float yaw
Definition CoreMath.h:181
float roll
Definition CoreMath.h:181
float pitch
Definition CoreMath.h:181
float x
Definition CoreMath.h:99
float z
Definition CoreMath.h:99
float y
Definition CoreMath.h:83
float w
Definition CoreMath.h:83
float z
Definition CoreMath.h:83
float x
Definition CoreMath.h:83
float x
Definition CoreMath.h:31
float z
Definition CoreMath.h:31
float y
Definition CoreMath.h:31
Definition CoreMath.h:214
int32_t Start
Definition CoreMath.h:215
int32_t End
Definition CoreMath.h:215
Definition CoreMath.h:137
uint16_t roll
Definition CoreMath.h:138
uint16_t yaw
Definition CoreMath.h:138
uint16_t pitch
Definition CoreMath.h:138
Definition CoreMath.h:115
int32_t Y
Definition CoreMath.h:116
int32_t X
Definition CoreMath.h:116
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