Class GradeScale

java.lang.Object
org.djunits.unit.scale.GradeScale
All Implemented Interfaces:
Serializable, Scale

public class GradeScale extends Object implements Scale
A Scale for transforming a slope as a grade, where 45 degrees is 1, and 90 degrees is infinite, to radians. The formula is: angle = atan(grade). The factor that is given, is the factor by which the value is multiplied to get a grade. When a scale is constructed for e.g. ratio as a percentage (100% instead of 1), the conversionFactor to apply is 0.01.

Copyright (c) 2013-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.

Author:
Alexander Verbraeck, Peter Knoppers
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    GradeScale(double conversionFactorToGrade)
    Construct a Scale for transforming a slope as a grade, where 45 degrees is 1, and 90 degrees is infinite, to radians.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    final double
    fromIdentityScale(double value)
    Convert a value from a base (SI) value on the identity scale to a value in the unit that uses this scale.
    final double
     
    int
     
    boolean
    Return whether a scale is an 'identity' scale.
    final double
    toIdentityScale(double value)
    Convert a value expressed in this unit to its base (SI) value on the identity scale.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • GradeScale

      public GradeScale(double conversionFactorToGrade)
      Construct a Scale for transforming a slope as a grade, where 45 degrees is 1, and 90 degrees is infinite, to radians.
      Parameters:
      conversionFactorToGrade - the conversion factor by which this number has to be multiplied to convert it to the standard (e.g., SI) unit.
  • Method Details

    • toIdentityScale

      public final double toIdentityScale(double value)
      Description copied from interface: Scale
      Convert a value expressed in this unit to its base (SI) value on the identity scale.
      Specified by:
      toIdentityScale in interface Scale
      Parameters:
      value - the value expressed in this unit
      Returns:
      the value converted to its SI value
    • fromIdentityScale

      public final double fromIdentityScale(double value)
      Description copied from interface: Scale
      Convert a value from a base (SI) value on the identity scale to a value in the unit that uses this scale.
      Specified by:
      fromIdentityScale in interface Scale
      Parameters:
      value - the value to convert
      Returns:
      the corresponding value in the given unit
    • getConversionFactorToGrade

      public final double getConversionFactorToGrade()
      Returns:
      conversionFactorToGrade
    • isIdentityScale

      public boolean isIdentityScale()
      Description copied from interface: Scale
      Return whether a scale is an 'identity' scale. For a linear scale, any scale with conversion factor 1 would be considered an identity scale.
      Specified by:
      isIdentityScale in interface Scale
      Returns:
      whether the scale is an 'identity' scale
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object