defaultLerp<T> static method

T defaultLerp<T>(
  1. T a,
  2. T b,
  3. double t
)

Default lerp function that works with numeric types.

This function performs basic arithmetic interpolation. It assumes the type supports addition, subtraction, and multiplication operators.

Type Parameters

  • T - The type to interpolate (must support arithmetic operations).

Parameters

  • a - The starting value.
  • b - The ending value.
  • t - The interpolation factor (0.0 to 1.0).

Returns

The interpolated value.

Implementation

static T defaultLerp<T>(T a, T b, double t) {
  return ((a as dynamic) + ((b as dynamic) - (a as dynamic)) * t) as T;
}