2019-10-06 17:26:17 -04:00
|
|
|
package com.chameleonvision.util;
|
2019-10-04 16:46:16 +03:00
|
|
|
|
2019-09-29 00:05:20 +03:00
|
|
|
import java.lang.Math;
|
2019-10-06 17:26:17 -04:00
|
|
|
|
2019-09-29 00:05:20 +03:00
|
|
|
public class MathHandler {
|
2019-10-06 17:26:17 -04:00
|
|
|
MathHandler() {}
|
|
|
|
|
|
2019-09-29 00:05:20 +03:00
|
|
|
public static double sigmoid(double x){
|
|
|
|
|
double bias = 0;
|
|
|
|
|
double a = 5;
|
|
|
|
|
double b = -0.05;
|
|
|
|
|
double k = 200;
|
2019-10-06 17:26:17 -04:00
|
|
|
|
2019-09-29 00:05:20 +03:00
|
|
|
if (x < 50){
|
2019-09-28 14:27:50 -07:00
|
|
|
bias = -1.338;
|
2019-09-29 00:05:20 +03:00
|
|
|
}
|
2019-10-06 17:26:17 -04:00
|
|
|
|
2019-09-29 00:05:20 +03:00
|
|
|
return ((k / (1 + Math.pow(Math.E,(a + (b * x))))) + bias);
|
|
|
|
|
}
|
2019-10-04 16:46:16 +03:00
|
|
|
public static double toSlope(double angle){
|
|
|
|
|
return FastMath.atan(FastMath.toRadians(angle - 90));
|
|
|
|
|
}
|
2019-09-29 00:05:20 +03:00
|
|
|
}
|