orbotix.robot.util
Class Value

java.lang.Object
  extended by orbotix.robot.util.Value

public class Value
extends java.lang.Object

Provides methods to constrain numerical values.


Constructor Summary
Value()
           
 
Method Summary
static double clamp(double value, double min, double max)
          Clamps a value between a minimum and maximum value.
static int clamp(int value, int min, int max)
          Clamps a value between a minimum and maximum value.
static double window(double value, double windowValue, double delta)
          Keeps a value at a fixed value if it is within some range of it.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Value

public Value()
Method Detail

clamp

public static double clamp(double value,
                           double min,
                           double max)
Clamps a value between a minimum and maximum value.

Parameters:
value - The value to clamp.
min - The minimum value.
max - The maximum value.

clamp

public static int clamp(int value,
                        int min,
                        int max)
Clamps a value between a minimum and maximum value.

Parameters:
value - The value to clamp.
min - The minimum value.
max - The maximum value.

window

public static double window(double value,
                            double windowValue,
                            double delta)
Keeps a value at a fixed value if it is within some range of it.

Parameters:
value - The value to window.
windowValue - A value that the value should be if it is within some delta of it.
delta - The delta used to calculate the range within the windowValue.
Returns:
A value constrained to the window value.