lerpLookupMap
Performs linear interpolation lookup for a list of query values.
Given sorted source and target lists of equal length, and a sorted list of queries, this function returns a list of interpolated values from target corresponding to each query in queries. For each query:
If the query is less than the smallest value in
source, the first value intargetis returned.If the query is greater than the largest value in
source, the last value intargetis returned.Otherwise, linear interpolation is performed between the two nearest values in
sourceand their corresponding values intarget.
Preconditions:
sourceandtargetmust be sorted in ascending order and have the same length.queriesmust be sorted in ascending order.
Return
List of interpolated values from target for each query.
Parameters
Sorted list of source values.
Sorted list of target values.
Sorted list of query values.
Throws
if source and target have different sizes or if source is empty.