uk.ac.starlink.ttools.plot2.layer
Class RangeScaler

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.layer.RangeScaler

public abstract class RangeScaler
extends Object

Scales values to the interval 0..1. Values outside the input range are clipped. NaN values stay NaN.

Since:
11 Jul 2013
Author:
Mark Taylor

Constructor Summary
RangeScaler()
           
 
Method Summary
static RangeScaler createScaler(boolean logFlag, boolean flipFlag, double lo, double hi)
          Creates a new scaler instance from explicit bounds.
static RangeScaler createScaler(boolean logFlag, boolean flipFlag, Range range)
          Creates a new scaler instance from a Range.
abstract  double scale(double dataValue)
          Scale input value to unit interval.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RangeScaler

public RangeScaler()
Method Detail

scale

public abstract double scale(double dataValue)
Scale input value to unit interval.

Parameters:
dataValue - input data value
Returns:
scaled value which will be either in the range 0..1 or NaN

createScaler

public static RangeScaler createScaler(boolean logFlag,
                                       boolean flipFlag,
                                       Range range)
Creates a new scaler instance from a Range.

Parameters:
logFlag - false for linear scaling, true for logarithmic
flipFlag - false for forward sense, true for inverted
range - data range which will be mapped to the interval 0..1
Returns:
new range scaler

createScaler

public static RangeScaler createScaler(boolean logFlag,
                                       boolean flipFlag,
                                       double lo,
                                       double hi)
Creates a new scaler instance from explicit bounds.

Parameters:
logFlag - false for linear scaling, true for logarithmic
flipFlag - false for forward sense, true for inverted
lo - lower bound of data range
hi - upper bound of data range
Returns:
new range scaler
Throws:
IllegalArgumentException - unless hi >= lo


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.