mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 11:12:23 +01:00
<feat: New project structure>
<feat: New release>
This commit is contained in:
44
dependencies/reboot/Project Reboot 3.0/UnrealMathUtility.h
vendored
Normal file
44
dependencies/reboot/Project Reboot 3.0/UnrealMathUtility.h
vendored
Normal 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
|
||||
};
|
||||
Reference in New Issue
Block a user