Package uk.ac.starlink.ttools.plot2
Class Scalings
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.Scalings
-
public class Scalings extends java.lang.ObjectImplementation class for functions to do with Scaling instances.- Since:
- 21 Mar 2019
- Author:
- Mark Taylor
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancanScale(Scaling[] scalings, Span dataSpan, Span fixSpan)Determines whether all of a list of scalings can be used to create Scaler objects from given span instances.static Scaling.RangeScalingcreateAsinhScaling(java.lang.String name, double delta)Constructs an asinh-based scaling.static RangercreateRanger(Scaling[] scalings)Returns a ranger suitable for use with all of a given list of scalings.static doubleunscale(Scaler scaler, double lo, double hi, double frac)Utility method to perform the inverse operation of Scaler.scaleValue.
-
-
-
Method Detail
-
createRanger
public static Ranger createRanger(Scaling[] scalings)
Returns a ranger suitable for use with all of a given list of scalings. If a ranger is obtained from this method and used to create aSpan, that span'screateScalermethod can be used with any of the scalings presented here.- Parameters:
scalings- list of scalings required for compatibility; null values are permitted, and add no constraints- Returns:
- suitable ranger
-
canScale
public static boolean canScale(Scaling[] scalings, Span dataSpan, Span fixSpan)
Determines whether all of a list of scalings can be used to create Scaler objects from given span instances.- Parameters:
scalings- scaling instances for which scalers may be requireddataSpan- span obtained from ranging datafixSpan- span obtained by direct user input of bounds- Returns:
- true iff spans are sufficient, false if new span instances are going to be needed
-
createAsinhScaling
public static Scaling.RangeScaling createAsinhScaling(java.lang.String name, double delta)
Constructs an asinh-based scaling.- Parameters:
name- scaling namedelta- output difference for lower-end input unit difference- Returns:
- scaling
-
unscale
public static double unscale(Scaler scaler, double lo, double hi, double frac)
Utility method to perform the inverse operation of Scaler.scaleValue.- Parameters:
scaler- scaler instancelo- lower bound of input data valuehi- upper bound of input data valuefrac- required output value of scaleValue method, must be in range 0..1- Returns:
- value x that causes scaler.scaleValue(x)
to return
frac
-
-