lerp method

Vector3 lerp(
  1. Vector3 v,
  2. double alpha
)

Linearly interpolate between this vector and v, where alpha is the percent distance along the line - alpha = 0 will be this vector, and alpha = 1 will be v.

  • v - Vector3 to interpolate towards.
  • alpha - interpolation factor, typically in the closed interval 0, 1.

Implementation

Vector3 lerp(Vector3 v, double alpha) {
  x += (v.x - x) * alpha;
  y += (v.y - y) * alpha;
  z += (v.z - z) * alpha;

  return this;
}