mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
25 lines
548 B
Java
25 lines
548 B
Java
package com.chameleonvision.util;
|
|
|
|
import java.lang.Math;
|
|
import org.apache.commons.math3.util.FastMath;
|
|
|
|
public class MathHandler {
|
|
MathHandler() {}
|
|
|
|
public static double sigmoid(double x){
|
|
double bias = 0;
|
|
double a = 5;
|
|
double b = -0.05;
|
|
double k = 200;
|
|
|
|
if (x < 50){
|
|
bias = -1.338;
|
|
}
|
|
|
|
return ((k / (1 + Math.pow(Math.E,(a + (b * x))))) + bias);
|
|
}
|
|
public static double toSlope(double angle){
|
|
return FastMath.atan(FastMath.toRadians(angle - 90));
|
|
}
|
|
}
|