Changed lerp() formula to be less susceptible to FP rounding errors.

This commit is contained in:
Revar Desmera 2018-11-25 15:22:58 -08:00
parent 81210a2a95
commit f64e16298d

View file

@ -52,7 +52,7 @@ function segs(r) = $fn>0?($fn>3?$fn:3):(ceil(max(min(360.0/$fa,abs(r)*2*PI/$fs),
// Interpolate between two values or vectors. 0.0 <= u <= 1.0
function lerp(a,b,u) = (b-a)*u + a;
function lerp(a,b,u) = (1-u)*a + u*b;
// Calculate hypotenuse length of 2D triangle.