4#include <libultraship.h>
33 FVector operator*(
float scalar)
const {
34 return FVector(
x * scalar,
y * scalar,
z * scalar);
37 float Dot(
const FVector& other)
const {
38 return x * other.
x +
y * other.
y +
z * other.
z;
42 FVector Cross(
const FVector& other)
const {
44 y * other.
z -
z * other.
y,
45 z * other.
x -
x * other.
z,
46 x * other.
y -
y * other.
x
50 float Magnitude()
const {
51 return std::sqrt(
x *
x +
y *
y +
z *
z);
54 FVector Normalize()
const {
55 float len = std::sqrt(
x *
x +
y *
y +
z *
z);
58 x / len,
y / len,
z / len
61 return FVector(0, 0, 0);
64 FVector() :
x(0),
y(0),
z(0) {}
65 FVector(
float x,
float y,
float z) :
x(
x),
y(
y),
z(
z) {}
96 FVector2D(
float x,
float z) :
x(
x),
z(
z) {}
134 [[nodiscard]]
void Set(uint16_t p, uint16_t y, uint16_t r) {
141 IRotator(
float p,
float y,
float r) {
142 pitch = p * (UINT16_MAX / 360);
143 yaw = y * (UINT16_MAX / 360);
144 roll = r * (UINT16_MAX / 360);
148 [[nodiscard]] FVector ToRadians()
const {
149 float scale = 2.0f *
M_PI / 65536.0f;
176 [[nodiscard]]
IRotator ToBinary()
const {
178 static_cast<uint16_t
>(
pitch * (UINT16_MAX / 360)),
179 static_cast<uint16_t
>(
yaw * (UINT16_MAX / 360)),
180 static_cast<uint16_t
>(
roll * (UINT16_MAX / 360))
185 FRotator(
float p,
float y,
float r) :
pitch(p),
yaw(y),
roll(r) {}
186 FRotator(IRotator rot) {
187 pitch =
static_cast<float>(rot.
pitch * (360 / UINT16_MAX));
188 yaw =
static_cast<float>(rot.
yaw * (360 / UINT16_MAX));
189 roll =
static_cast<float>(rot.
roll * (360 / UINT16_MAX));
210 IPathSpan& operator=(
const IPathSpan& Other) {
211 if (
this != &Other) {
219 bool operator==(
const IPathSpan& Other)
const {
224 bool operator!=(
const IPathSpan& Other)
const {
225 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:164
float yaw
Definition CoreMath.h:165
float roll
Definition CoreMath.h:165
float pitch
Definition CoreMath.h:165
float x
Definition CoreMath.h:86
float z
Definition CoreMath.h:86
float y
Definition CoreMath.h:70
float w
Definition CoreMath.h:70
float z
Definition CoreMath.h:70
float x
Definition CoreMath.h:70
float x
Definition CoreMath.h:19
float z
Definition CoreMath.h:19
float y
Definition CoreMath.h:19
Definition CoreMath.h:198
int Start
Definition CoreMath.h:199
int End
Definition CoreMath.h:199
Definition CoreMath.h:123
uint16_t roll
Definition CoreMath.h:124
uint16_t yaw
Definition CoreMath.h:124
uint16_t pitch
Definition CoreMath.h:124
Definition CoreMath.h:101
int32_t Y
Definition CoreMath.h:102
int32_t X
Definition CoreMath.h:102