Package com.stuypulse.stuylib.math
Class SLMath
java.lang.Object
com.stuypulse.stuylib.math.SLMath
SLMath (StuyLib Math) is a class containing many algorithms that are useful for developing robot
 code. Algorithms include limit, deadband, raising to powers while keeping the sign, and some
 other new algorithms we came up with.
- 
Method Summary
Modifier and TypeMethodDescriptionstatic doubleclamp(double x) clamp input from -1 to 1static doubleclamp(double x, double max) clamp input from max to -maxstatic doubleclamp(double x, double min, double max) clamp input from max to minstatic doubledeadband(double x, double window) Dead bands x value with window being the dead band.static doublespow(double x, double power) spow (signless pow), raises a number to a power without affecting the sign of the number 
- 
Method Details
- 
clamp
public static double clamp(double x, double min, double max) clamp input from max to min- Parameters:
 x- inputmin- min value for xmax- max value for x- Returns:
 - clamp input
 
 - 
clamp
public static double clamp(double x, double max) clamp input from max to -max- Parameters:
 x- inputmax- max and min value- Returns:
 - clamped input
 
 - 
clamp
public static double clamp(double x) clamp input from -1 to 1- Parameters:
 x- input- Returns:
 - clamped input
 
 - 
deadband
public static double deadband(double x, double window) Dead bands x value with window being the dead band. all values for this are [-1.0...1.0]- Parameters:
 x- valuewindow- deadband window- Returns:
 - deadbanded value
 
 - 
spow
public static double spow(double x, double power) spow (signless pow), raises a number to a power without affecting the sign of the number- Parameters:
 x- inputpower- power to raise x to- Returns:
 - input ^ power
 
 
 -