mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-01-17 14:28:30 +01:00
Helper function for linear interpolation
This commit is contained in:
parent
045f5e14c2
commit
f3307e47a8
@ -26,6 +26,13 @@ static char hex[] = "0123456789ABCDEF";
|
||||
|
||||
char *exe_name(void);
|
||||
|
||||
//Linear interpolation
|
||||
template <typename T> inline T LinearInterpolate(T val1, T val2, T lowerCoord, T upperCoord, T coord)
|
||||
{
|
||||
if(lowerCoord == upperCoord) return val1;
|
||||
return (((val2 - val1) / (upperCoord - lowerCoord)) * (coord - lowerCoord)) + val1;
|
||||
}
|
||||
|
||||
//Signum function
|
||||
int isign(float i);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user