Class SolaMath

java.lang.Object
technology.sola.math.SolaMath

@NullMarked public final class SolaMath extends Object
SolaMath is a collection of static math functions.
  • Method Details

    • lerp

      public static float lerp(float start, float end, float percent)
      Linearly interpolates a value between start and end.
      Parameters:
      start - the minimum value to return
      end - the maximum value to return
      percent - the "progress" towards the end value
      Returns:
      the linearly interpolated value clamped between start and end
    • lerp

      public static float lerp(float start, float end, float percent, EasingFunction easingFunction)
      Interpolates a value between start and end via desired EasingFunction.
      Parameters:
      start - the minimum value to return
      end - the maximum value to return
      percent - the "progress" towards the end value
      easingFunction - the EasingFunction used during interpolation
      Returns:
      the interpolated value clamped between start and end
    • lerp

      public static Vector2D lerp(Vector2D start, Vector2D end, float percent)
      Linearly interpolates a Vector2D value between start and end.
      Parameters:
      start - the minimum value to return
      end - the maximum value to return
      percent - the "progress" towards the end value
      Returns:
      the linearly interpolated vector clamped between start and end
    • lerp

      public static Vector2D lerp(Vector2D start, Vector2D end, float percent, EasingFunction easingFunction)
      Interpolates a Vector2D value between start and end via desired EasingFunction.
      Parameters:
      start - the minimum value to return
      end - the maximum value to return
      percent - the "progress" towards the end value
      easingFunction - the EasingFunction used during interpolation
      Returns:
      the interpolated vector clamped between start and end
    • clamp

      public static float clamp(float min, float max, float value)
      Clamps a float value between a min and max.
      Parameters:
      min - the minimum value
      max - the maximum value
      value - the value to clamp
      Returns:
      the clamped value
    • clamp

      public static Vector2D clamp(Vector2D min, Vector2D max, Vector2D value)
      Clamps a Vector2D between a min and max.
      Parameters:
      min - the minimum value
      max - the maximum value
      value - the value to clamp
      Returns:
      the clamped Vector2D
    • fastRound

      public static int fastRound(float value)
      Rounds a positive float value to the nearest integer quickly.
      Parameters:
      value - the float value to round
      Returns:
      the rounded value