<feat: New project structure>

<feat: New release>
This commit is contained in:
Alessandro Autiero
2023-09-02 15:34:15 +02:00
parent 64b33102f4
commit b41e22adeb
953 changed files with 1373072 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
#pragma once
#include "GenericPlatformMath.h"
struct FMath : public FGenericPlatformMath
{
template< class T >
static FORCEINLINE T Clamp(const T X, const T Min, const T Max)
{
return X < Min ? Min : X < Max ? X : Max;
}
template< class T >
static FORCEINLINE T Square(const T A)
{
return A * A;
}
#define FASTASIN_HALF_PI (1.5707963050f)
/**
* Computes the ASin of a scalar value.
*
* @param Value input angle
* @return ASin of Value
*/
static FORCEINLINE float FastAsin(float Value)
{
// Clamp input to [-1,1].
bool nonnegative = (Value >= 0.0f);
float x = FMath::Abs(Value);
float omx = 1.0f - x;
if (omx < 0.0f)
{
omx = 0.0f;
}
float root = FMath::Sqrt(omx);
// 7-degree minimax approximation
float result = ((((((-0.0012624911f * x + 0.0066700901f) * x - 0.0170881256f) * x + 0.0308918810f) * x - 0.0501743046f) * x + 0.0889789874f) * x - 0.2145988016f) * x + FASTASIN_HALF_PI;
result *= root; // acos(|x|)
// acos(x) = pi - acos(-x) when x < 0, asin(x) = pi/2 - acos(x)
return (nonnegative ? FASTASIN_HALF_PI - result : result - FASTASIN_HALF_PI);
}
#undef FASTASIN_HALF_PI
};