Class TMath

java.lang.Object
com.thecsdev.common.math.TMath

public final class TMath extends Object
TheCSDev's mathematics-related utilities.
  • Method Summary

    Modifier and Type
    Method
    Description
    static final double
    clamp01d(double value)
    Clamps a double value to the range [0.0, 1.0].
    static final double
    clamp01f(float value)
    Clamps a float value to the range [0.0f, 1.0f].
    static final double
    clampd(double value, double min, double max)
    Deprecated, for removal: This API element is subject to removal in a future version.
    static final float
    clampf(float value, float min, float max)
    Deprecated, for removal: This API element is subject to removal in a future version.
    static final int
    clampi(int value, int min, int max)
    Deprecated, for removal: This API element is subject to removal in a future version.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • clampi

      @Deprecated(forRemoval=true) public static final int clampi(int value, int min, int max)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Clamps a int value to the given min/max range.
      Parameters:
      value - the value to clamp
      min - The minimum value.
      max - The maximum value.
      Returns:
      min if value < min, max if value > max, otherwise value.
    • clampf

      @Deprecated(forRemoval=true) public static final float clampf(float value, float min, float max)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Clamps a float value to the given min/max range.
      Parameters:
      value - the value to clamp
      min - The minimum value.
      max - The maximum value.
      Returns:
      min if value < min, max if value > max, otherwise value.
    • clampd

      @Deprecated(forRemoval=true) public static final double clampd(double value, double min, double max)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Clamps a double value to the given min/max range.
      Parameters:
      value - the value to clamp
      min - The minimum value.
      max - The maximum value.
      Returns:
      min if value < min, max if value > max, otherwise value.
    • clamp01f

      public static final double clamp01f(float value)
      Clamps a float value to the range [0.0f, 1.0f].
      Parameters:
      value - the value to clamp
      Returns:
      0.0f if value < 0.0f, 1.0f if value > 1.0f, otherwise value.
    • clamp01d

      public static final double clamp01d(double value)
      Clamps a double value to the range [0.0, 1.0].
      Parameters:
      value - the value to clamp
      Returns:
      0.0 if value < 0.0, 1.0 if value > 1.0, otherwise value.