linear
Creates an empty map with linear interpolation.
Uses linear interpolation to approximate values between control points: \(y = y_1 + (y_2 - y_1) \cdot t\) where \(t \in 0.0, 1.0\).
Linear interpolation is straightforward, efficient, and suitable for most general-purpose use cases.
Example:
val map = InterpolatingMap.linear()
map[0.0] = 0.0
map[1.0] = 1.0
val value = map[0.5] // 0.5Content copied to clipboard
Return
an empty InterpolatingMap with linear interpolation
Creates a map with linear interpolation initialized with given control points.
Uses linear interpolation to approximate values between control points.
Return
an InterpolatingMap with the given data and linear interpolation
Parameters
keys
the x-coordinates of the control points (will be sorted)
values
the y-coordinates of the control points
Throws
if keys.size != values.size