/** * Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change * amount. * * @param endQuat * @param changeAmnt * @param store * the quaternion to store the result in for return. If null, a new quaternion object is created and * returned. * @return a new quaternion containing the result. */ @Override public Quaternion slerp(final ReadOnlyQuaternion endQuat, final double changeAmnt, final Quaternion store) { return Quaternion.slerp(this, endQuat, changeAmnt, store); }
final Quaternion quat = new Quaternion(); final Quaternion quat2 = new Quaternion().applyRotationY(MathUtils.HALF_PI); final Quaternion store = quat.slerp(quat2, .5, null); assertTrue(Math.abs(new Vector3(Math.sin(MathUtils.QUARTER_PI), 0, Math.sin(MathUtils.QUARTER_PI)) .distance(store.apply(Vector3.UNIT_Z, null))) <= Quaternion.ALLOWED_DEVIANCE); quat.slerp(quat2, 1.0, store); assertTrue(Math.abs(new Vector3(-1, 0, 0).distance(store.apply(Vector3.UNIT_X, null))) <= Quaternion.ALLOWED_DEVIANCE); quat.slerp(quat2, .5, store); assertTrue(Math.abs(new Vector3(0, 1, 0).distance(store.apply(Vector3.UNIT_X, null))) <= Quaternion.ALLOWED_DEVIANCE); quat.slerp(quat2, 0, store); assertTrue(Math.abs(new Vector3(1, 0, 0).distance(store.apply(Vector3.UNIT_X, null))) <= Quaternion.ALLOWED_DEVIANCE); quat.slerp(quat2, 0.25, store); assertTrue(Math.abs(new Vector3(1, 0, 0).distance(store.apply(Vector3.UNIT_X, null))) <= Quaternion.ALLOWED_DEVIANCE); quat.slerp(quat2, 0.5, store); assertTrue(Math.abs(new Vector3(0, -Math.sin(MathUtils.QUARTER_PI), Math.sin(MathUtils.QUARTER_PI)) .distance(store.apply(Vector3.UNIT_Y, null))) <= Quaternion.ALLOWED_DEVIANCE);
/** * Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change * amount. * * @param endQuat * @param changeAmnt * @param store * the quaternion to store the result in for return. If null, a new quaternion object is created and * returned. * @return a new quaternion containing the result. */ @Override public Quaternion slerp(final ReadOnlyQuaternion endQuat, final double changeAmnt, final Quaternion store) { return Quaternion.slerp(this, endQuat, changeAmnt, store); }
Quaternion.slerp(_rotation, blendTo.getRotation(), weight, tData._rotation); return tData;
Quaternion.slerp(_rotation, blendTo.getRotation(), weight, tData._rotation); return tData;