Package org.ironmaple.utils.mathutils
Class MapleCommonMath
java.lang.Object
org.ironmaple.utils.mathutils.MapleCommonMath
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleconstrainMagnitude(double value, double maxMagnitude) Constrains the magnitude of a value.static doublegenerateRandomNormal(double mean, double stdDev) using the random number generator of a fixed seed, generate the next random normal variablestatic Rotation2dgetAngle(Translation2d translation2d) Obtains the angle of a translation, ignores zero translation.static doublelinearInterpretation(double x1, double y1, double x2, double y2, double x) static doublelinearInterpretationWithBounding(double x1, double y1, double x2, double y2, double x)
-
Constructor Details
-
MapleCommonMath
public MapleCommonMath()
-
-
Method Details
-
generateRandomNormal
public static double generateRandomNormal(double mean, double stdDev) using the random number generator of a fixed seed, generate the next random normal variable- Parameters:
mean- the center of the distributionstdDev- the standard deviation of the distribution- Returns:
- the next random variable x from the distribution
-
constrainMagnitude
public static double constrainMagnitude(double value, double maxMagnitude) Constrains the magnitude of a value.
- Parameters:
value- the value to constrainmaxMagnitude- the maximum allowed magnitude- Returns:
- the constrained value
-
linearInterpretationWithBounding
public static double linearInterpretationWithBounding(double x1, double y1, double x2, double y2, double x) -
linearInterpretation
public static double linearInterpretation(double x1, double y1, double x2, double y2, double x) -
getAngle
Obtains the angle of a translation, ignores zero translation.
This prevents the driver-station from throwing a bunch of "x and y components of Rotation2d are zero" warning.
- Parameters:
translation2d- the translation- Returns:
- the angle of the translation, or zero if the translation is zero
-