You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
862 B
39 lines
862 B
#pragma once
|
|
#include <memory.h>
|
|
#include <cstdlib>
|
|
#include <cstdio>
|
|
#include <cmath>
|
|
#include <vector>
|
|
#include <unordered_map>
|
|
|
|
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/(float div) const
|
|
{
|
|
return Vec3(x / div, y / div, z / div);
|
|
}
|
|
|
|
Vec3 operator-() const
|
|
{
|
|
return Vec3(-x, -y, -z);
|
|
}
|
|
} vec3_t;
|
|
|
|
inline float dotProduct(vec3_t a, vec3_t b)
|
|
{
|
|
return a.x * b.x + a.y * b.y + a.z * b.z;
|
|
}
|