JOML-CI / JOML

A Java math library for OpenGL rendering calculations
MIT License
728 stars 104 forks source link

JOML needs linear interpolation of vectors: v1.linearInterpolation(v2, alpha) #259

Closed lukehutch closed 4 years ago

lukehutch commented 4 years ago

The following operation is very common in many applications, but it is inefficient if implemented as shown:

Vector3d v3 = v1.mul(1.0 - alpha, new Vector3d()).add(v2.mul(alpha, new Vector3d());

It would be handy (and more efficient) to have a method v1.linearInterpolation(v2, alpha, dest) that implements this directly.

Or potentially this could be called lerp, since the Quaternion version is already named slerp.

lukehutch commented 4 years ago

Oops, found it -- it already exists as lerp :-) (Sorry! I was looking under linearInterpolation...)