mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Float stuff
This commit is contained in:
parent
ce8caa9f89
commit
5774ceb9e1
@ -660,6 +660,34 @@ float sqrtf(float x)
|
||||
return guess;
|
||||
}
|
||||
|
||||
double clamp(double x, double low, double high)
|
||||
{
|
||||
if (x < low)
|
||||
return low;
|
||||
else if (x > high)
|
||||
return high;
|
||||
else
|
||||
return x;
|
||||
}
|
||||
|
||||
float lerp(float a, float b, float t)
|
||||
{
|
||||
return (1 - t) * a + t * b;
|
||||
}
|
||||
|
||||
float smoothstep(float a, float b, float t)
|
||||
{
|
||||
t = clamp(t, 0.0, 1.0);
|
||||
return lerp(a, b, t * t * (3 - 2 * t));
|
||||
}
|
||||
|
||||
float cubicInterpolate(float a, float b, float t)
|
||||
{
|
||||
float t2 = t * t;
|
||||
float t3 = t2 * t;
|
||||
return a + (-2 * t3 + 3 * t2) * b;
|
||||
}
|
||||
|
||||
char *strtok(char *src, const char *delim)
|
||||
{
|
||||
static char *src1;
|
||||
|
@ -18,6 +18,11 @@ extern "C"
|
||||
char *reverse(char *Buffer, int i, int j);
|
||||
|
||||
float sqrtf(float x);
|
||||
double clamp(double x, double low, double high);
|
||||
|
||||
float lerp(float a, float b, float t);
|
||||
float smoothstep(float a, float b, float t);
|
||||
float cubicInterpolate(float a, float b, float t);
|
||||
|
||||
void backspace(char s[]);
|
||||
void append(char s[], char n);
|
||||
|
Loading…
x
Reference in New Issue
Block a user