vectorSlerpOptimized static method

Float32x4 vectorSlerpOptimized(
  1. Float32x4List preList,
  2. Float32x4 last,
  3. double step,
  4. double t,
)

Implementation

static Float32x4 vectorSlerpOptimized(
    Float32x4List preList, Float32x4 last, double step, double t) {
  var matchedRangeStartIndex = t ~/ step;

  var length = preList.length - 1;

  if (matchedRangeStartIndex == length) return last;

  var modulus = t >= step ? (t - matchedRangeStartIndex * step) : t;

  var segment = modulus / step;

  return lerpUnclampedOptimized(
    preList[matchedRangeStartIndex],
    preList[matchedRangeStartIndex + 1],
    Float32x4.splat(segment),
  );
}