vectorSlerp static method
Implementation
static Vector3 vectorSlerp(List<double> inputs, List<Vector3> results, double desiredInput) {
var n = inputs.length;
var inputMin = inputs[0];
var inputMax = inputs[n - 1];
// Don't support extrapolation:
if (desiredInput < inputMin) return results[0];
if (desiredInput >= inputMax) return results[n - 1];
// Map to values that correspond to the array index progression
var percent = inverseLerp(inputMin, inputMax, desiredInput);
var step = 1 / (n - 1);
var matchedRangeStartIndex = percent ~/ step;
var matchedRangePct = (percent % step) / step;
return lerpUnclamped(
results[matchedRangeStartIndex],
results[matchedRangeStartIndex + 1],
matchedRangePct,
);
}