All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.math.Lerp.kt Maven / Gradle / Ivy

The newest version!
package math

/**
 * Linear interpolation between point a and b
 * @param a is the starting point
 *
 * @param b is the endpoint
 *
 * @param t is the interpolation ratio
 */
inline fun lerp(a: Double, b: Double, t: Double): Double = a + (b - a) * t

/**
 * Linear interpolation between point a and b
 * @param a is the starting point
 *
 * @param b is the endpoint
 *
 * @param t is the interpolation ratio
 */
inline fun lerp(a: Number, b: Number, t: Double) = math.lerp(a.toDouble(), b.toDouble(), t)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy