I have often found it useful lately to LERP both buffers and vectors. Perhaps this has merit inside the library?

This method would be helpful:

vector.LERP(percent,vector2);

etc...

I have often found it useful lately to LERP both buffers and vectors. Perhaps this has merit inside the library?

This method would be helpful:

vector.LERP(percent,vector2);

etc...

Vector3f contains an interpolate method.

What do you mean by "buffers"? Accept a FloatBuffer as an argument into the vector interpolate method?

More like two buffers could be interpolated.

I feel like an ass, completely missed the interpolate method. All though it is local only which means I have to create an empty vector first which is a bit clumsy sometimes.

I would like:

Vector3f vect= Vector3f.interpolate(.5f,vectA,vectB);

might be good to have as an option, but usually not preferred memorywiseâ€¦

I can do this

Quaternion rotation = new Quaternion().slerp(from.getRotation(), to.getRotation(), percent);

but not this...

Vector3f translate = new Vector3f ().interpolate(from.getTranslate (), to.getTranslate(), percent);

instead i have to do this...

Vector3f translate = (Vector3f) from.getTranslate().clone();

translate.interpolate(to.getTranslate(), percent);

Also FastMath.lerp has the signature:

public static float LERP(float percent, float startValue, float endValue) ;

Where the percent change comes first and the values second, why is this different with both the Vector interpolation and the quaternion?

I have been using this code:

public static Vector3f vector3fLERP( final float percent , final Vector3f from , final Vector3f to ) {

final Vector3f vector3f = new Vector3f(

FastMath.LERP(percent, from.x, to.x),

FastMath.LERP(percent, from.y,to.y),

FastMath.LERP(percent, from.z, to.z));

return vector3f;

}

This has the advantage of:

1) providing a new vector and

2) more subtle, it doesn't return an invalid vector if both the vectors have the same value.

you can do like this though:

Vector3f translate = new Vector3f();

translate.interpolate(from.getTranslate(), to.getTranslate(), percent);

but returning "this" from the method might be a change we could do

This does bring up a good point, though. One of the tasks we need to do before 1.0 is check for consistency.

definitely

FastMath.lerp()

does this check:

if (startValue == endValue) return startValue;

Therefore I believe the interpolate method for vector should as well.