#pragma once #include #include #include #include #include #include #include #include typedef float scalar_t; // Scalar value, typedef struct Vec3 // Vector or Position { scalar_t x; // horizontal scalar_t y; // horizontal scalar_t z; // vertical Vec3() : x(0), y(0), z(0) { } Vec3(float x, float y, float z) : x(x), y(y), z(z) { } Vec3 operator+(const Vec3& other) const { return Vec3(x + other.x, y + other.y, z + other.z); } Vec3 operator-(const Vec3& other) const { return Vec3(x - other.x, y - other.y, z - other.z); } Vec3 operator*(float mul) const { return Vec3(x * mul, y * mul, z * mul); } Vec3 operator/(float div) const { return Vec3(x / div, y / div, z / div); } Vec3 operator-() const { return Vec3(-x, -y, -z); } float magnitude() const { return sqrtf(x * x + y * y + z * z); } Vec3 normalized() const { float invMag = 1.0f / magnitude(); return Vec3(x * invMag, y * invMag, z * invMag); } float dotProduct(const Vec3 &other) const { return x * other.x + y * other.y + z * other.z; } Vec3 crossProduct(const Vec3 &other) const { return Vec3(y * other.z - z * other.y, z * other.x - x * other.z, x * other.y - y * other.x); } } vec3_t;