package ocelot.desktop.util

object NumberUtils {
  implicit class ExtendedFloat(val v: Float) extends AnyVal {
    def lerp(that: Float, alpha: Float): Float = v * (1 - alpha) + that * alpha

    def clamped(min: Float = 0f, max: Float = 1f): Float = v.min(max).max(min)
  }

  implicit class ExtendedInt(val v: Int) extends AnyVal {
    def clamped(min: Int, max: Int): Int = v.min(max).max(min)
  }

  implicit class ExtendedLong(val v: Long) extends AnyVal {
    def clamped(min: Long, max: Long): Float = v.min(max).max(min)
  }
}
