diff --git a/ncc/include/uvm/math.h b/ncc/include/uvm/math.h index f43712c..6687e61 100644 --- a/ncc/include/uvm/math.h +++ b/ncc/include/uvm/math.h @@ -1,8 +1,6 @@ #ifndef __UVM_MATH_H__ #define __UVM_MATH_H__ -//#include - // Minimum of two values #ifndef MIN #define MIN(a, b) (a < b? a:b) @@ -18,6 +16,11 @@ #define CLAMP(x, min, max) MIN(MAX(x, min), max) #endif +// Linear interpolation between two values +#ifndef LERP +#define LERP(a, b, x) ((1 - x) * a + (x * b)) +#define LERP + // Remap a value from range [a0, a1] into range [b0, b1] #ifndef REMAP #define REMAP(v, a0, a1, b0, b1) (b0 + (b1 - b0) * ((v) - a0) / (a1 - a0))