[wpimath] Refactor MathUtil.interpolate() and MathUtil.inverseInterpolate() to handle extrapolation (#8232)

This commit is contained in:
Tyler Veness
2025-09-20 11:22:05 -07:00
committed by GitHub
parent 1ce2854a1e
commit f701132392
12 changed files with 84 additions and 75 deletions

View File

@@ -328,9 +328,9 @@ public class Color {
*/
public static int lerpRGB(int r1, int g1, int b1, int r2, int g2, int b2, double t) {
return packRGB(
(int) MathUtil.interpolate(r1, r2, t),
(int) MathUtil.interpolate(g1, g2, t),
(int) MathUtil.interpolate(b1, b2, t));
(int) MathUtil.lerp(r1, r2, t),
(int) MathUtil.lerp(g1, g2, t),
(int) MathUtil.lerp(b1, b2, t));
}
/*