pslib
Class PSRange

java.lang.Object
  extended by pslib.PSRange
All Implemented Interfaces:
PSConstants

public class PSRange
extends java.lang.Object
implements PSConstants

PSRange Class

The PSRange object allows a minimum and maximum value to be stored. Calls to get() map a value between 0 and 1 to the range and apply the specified envelope and curvature.


Field Summary
 
Fields inherited from interface pslib.PSConstants
CAM2D_LOOK, CAM2D_RIGHT, CAM2D_UP, CORNER, INVERSE, INVERSE_TRIANGULAR, LEADING, LINEAR, MIDPOINT, NONE, STATIC, TRAILING, TRIANGULAR
 
Constructor Summary
PSRange(float mi, float ma)
          Create a new object instance with the specified values
PSRange(float mi, float ma, int m)
          Create a new object instance with the specified values
PSRange(float mi, float ma, int m, float c)
          Create a new object instance with the specified values
 
Method Summary
 float get(float v)
          Map the input value to the range of this object instance
 float[] getRange()
           
 void setCurve(float c)
          Set the curve exponent
 void setMode(int m)
          Set the envelope mode
 void setRange(float mi, float ma)
          Set the minimum and maximum values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSRange

public PSRange(float mi,
               float ma)
Create a new object instance with the specified values

Parameters:
mi - minimum
ma - maximum

PSRange

public PSRange(float mi,
               float ma,
               int m)
Create a new object instance with the specified values

Parameters:
mi - minimum
ma - maximum
m - envelope mode

PSRange

public PSRange(float mi,
               float ma,
               int m,
               float c)
Create a new object instance with the specified values

Parameters:
mi - minimum
ma - maximum
m - envelope mode
c - curve exponent
Method Detail

setRange

public final void setRange(float mi,
                           float ma)
Set the minimum and maximum values

Parameters:
mi - minimum
ma - maximum

getRange

public final float[] getRange()

setMode

public final void setMode(int m)
Set the envelope mode

Available modes are: LINEAR, INVERSE, TRIANGULAR and INVERSE_TRIANGULAR

Parameters:
m - envelope mode

setCurve

public final void setCurve(float c)
Set the curve exponent

Parameters:
c - curve exponent

get

public final float get(float v)
Map the input value to the range of this object instance

Input values will be constrained between 0 and 1

Parameters:
v - input value
Returns:
the mapped result