Class Scalings

java.lang.Object
uk.ac.starlink.ttools.plot2.Scalings

public class Scalings extends Object
Implementation class for functions to do with Scaling instances.
Since:
21 Mar 2019
Author:
Mark Taylor
  • Method Details

    • 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 a Span, that span's createScaler method 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 required
      dataSpan - span obtained from ranging data
      fixSpan - 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(String name, double delta)
      Constructs an asinh-based scaling.
      Parameters:
      name - scaling name
      delta - 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 instance
      lo - lower bound of input data value
      hi - upper bound of input data value
      frac - required output value of scaleValue method, must be in range 0..1
      Returns:
      value x that causes scaler.scaleValue(x) to return frac