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);
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);
Vector3f translate = new Vector3f ().interpolate(from.getTranslate (), to.getTranslate(), percent);
Vector3f translate = (Vector3f) from.getTranslate().clone();
translate.interpolate(to.getTranslate(), percent);
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;
}
you can do like this though:
Vector3f translate = new Vector3f();
translate.interpolate(from.getTranslate(), to.getTranslate(), percent);
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;