2252 DMR Decoder error where LinearyInterpolator gets mu value outside 0 to 1.0 range. (#2253)

Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
Denny Sheirer
2025-06-30 03:21:08 -04:00
committed by GitHub
parent d86f8bf3d9
commit 912925ee7d

View File

@@ -33,9 +33,13 @@ public class LinearInterpolator
*/
public static float calculate(float x1, float x2, float mu)
{
if(mu < 0 || mu > 1)
if(mu < 0)
{
throw new IllegalArgumentException("mu [" + mu + "] must be between 0 and 1");
return x1;
}
else if(mu > 1)
{
return x2;
}
return x1 + ((x2 - x1) * mu);