const a1 = [0, 1, 0, 1];
const b1 = [1, 0, 0, 1];
const a2 = [0, 1, 0, 1];
const b2 = [0, 1, 0, 0.5];
const a3 = quat.fromEuler(0.1, 0.2, 0.3, 'xyz');
const b3 = quat.fromEuler(0.3, 0.2, 0.1, 'xyz');
const tests = [
{ a: a1, b: b1, t: 0, expected: [0, 1, 0, 1], },
{ a: a1, b: b1, t: 1, expected: [1, 0, 0, 1], },
{ a: a1, b: b1, t: 0.5, expected: [0.5, 0.5, 0, 1], },
{ a: a2, b: b2, t: 0.5, expected: [0, 1, 0, 0.75], },
{ a: a3, b: b3, t: 0.5, expected: [0.1089731245591333, 0.09134010671547867, 0.10897312455913327, 0.9838224947381737], },
];
for (const {a, b, t, expected} of tests) {
testQuatWithAndWithoutDest((a, b, t, dst) => {
return quat.slerp(a, b, t, dst);
}, expected, a, b, t);
}
const a1 = [0, 1, 0, 1];
const b1 = [1, 0, 0, 1];
const a2 = [0, 1, 0, 1];
const b2 = [0, 1, 0, 0.5];
const a3 = quat.fromEuler(0.1, 0.2, 0.3, 'xyz');
const b3 = quat.fromEuler(0.3, 0.2, 0.1, 'xyz');
const tests = [
{ a: a1, b: b1, t: 0, expected: [0, 1, 0, 1], },
{ a: a1, b: b1, t: 1, expected: [1, 0, 0, 1], },
{ a: a1, b: b1, t: 0.5, expected: [0.5, 0.5, 0, 1], },
{ a: a2, b: b2, t: 0.5, expected: [0, 1, 0, 0.75], },
{ a: a3, b: b3, t: 0.5, expected: [0.1089731245591333, 0.09134010671547867, 0.10897312455913327, 0.9838224947381737], },
];
for (const {a, b, t, expected} of tests) {
testQuatWithAndWithoutDest((a, b, t, dst) => {
return quat.slerp(a, b, t, dst);
}, expected, a, b, t);
}
const a1 = [0, 1, 0, 1];
const b1 = [1, 0, 0, 1];
const a2 = [0, 1, 0, 1];
const b2 = [0, 1, 0, 0.5];
const a3 = quat.fromEuler(0.1, 0.2, 0.3, 'xyz');
const b3 = quat.fromEuler(0.3, 0.2, 0.1, 'xyz');
const tests = [
{ a: a1, b: b1, t: 0, expected: [0, 1, 0, 1], },
{ a: a1, b: b1, t: 1, expected: [1, 0, 0, 1], },
{ a: a1, b: b1, t: 0.5, expected: [0.5, 0.5, 0, 1], },
{ a: a2, b: b2, t: 0.5, expected: [0, 1, 0, 0.75], },
{ a: a3, b: b3, t: 0.5, expected: [0.1089731245591333, 0.09134010671547867, 0.10897312455913327, 0.9838224947381737], },
];
for (const {a, b, t, expected} of tests) {
testQuatWithAndWithoutDest((a, b, t, dst) => {
return quat.slerp(a, b, t, dst);
}, expected, a, b, t);
}