mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-10 11:09:45 +08:00
30 lines
534 B
C++
30 lines
534 B
C++
#pragma once
|
|
|
|
namespace big::math
|
|
{
|
|
inline float deg_to_rad(float deg)
|
|
{
|
|
double radian = (3.14159265359 / 180) * deg;
|
|
return (float)radian;
|
|
}
|
|
|
|
inline double distance_between_vectors(Vector3 a, Vector3 b)
|
|
{
|
|
return sqrt(pow((a.x - b.x), 2) + pow((a.y - b.y), 2) + pow((a.z - b.z), 2));
|
|
}
|
|
|
|
inline Vector3 rotation_to_direction(Vector3 rotation)
|
|
{
|
|
float x = deg_to_rad(rotation.x);
|
|
float z = deg_to_rad(rotation.z);
|
|
|
|
float num = abs(cos(x));
|
|
|
|
return Vector3
|
|
{
|
|
-sin(z) * num,
|
|
cos(z) * num,
|
|
sin(x)
|
|
};
|
|
}
|
|
} |