const tests = [
{ args: [0, 0, 0, 'xyz'], expected: [0, 0, 0, 1], },
{ args: [Math.PI, 0, 0, 'xyz'], expected: [1, 0, 0, 0], },
{ args: [0, Math.PI, 0, 'xyz'], expected: [0, 1, 0, 0], },
{ args: [0, 0, Math.PI, 'xyz'], expected: [0, 0, 1, 0], },
{ args: [Math.PI, Math.PI, 0, 'xyz'], expected: [0, 0, 1, 0], },
{ args: [Math.PI, Math.PI, 0, 'yxz'], expected: [0, 0, -1, 0], },
{ args: [0, Math.PI, Math.PI, 'xyz'], expected: [1, 0, 0, 0], },
{ args: [0, Math.PI, Math.PI, 'xzy'], expected: [-1, 0, 0, 0], },
{ args: [Math.PI, 0, Math.PI, 'xyz'], expected: [0, -1, 0, 0], },
{ args: [Math.PI, 0, Math.PI, 'zyx'], expected: [0, 1, 0, 0], },
{ args: [Math.PI, 0, Math.PI, 'zxy'], expected: [0, 1, 0, 0], },
{ args: [0.1, Math.PI, 0, 'zyx'], expected: [0, 0.9987502694129944, -0.04997916892170906, 0 ]},
];
for (const {args, expected} of tests) {
testQuatWithAndWithoutDest((...args) => {
return quat.fromEuler(...args);
}, expected, ...args);
}
const tests = [
{ args: [0, 0, 0, 'xyz'], expected: [0, 0, 0, 1], },
{ args: [Math.PI, 0, 0, 'xyz'], expected: [1, 0, 0, 0], },
{ args: [0, Math.PI, 0, 'xyz'], expected: [0, 1, 0, 0], },
{ args: [0, 0, Math.PI, 'xyz'], expected: [0, 0, 1, 0], },
{ args: [Math.PI, Math.PI, 0, 'xyz'], expected: [0, 0, 1, 0], },
{ args: [Math.PI, Math.PI, 0, 'yxz'], expected: [0, 0, -1, 0], },
{ args: [0, Math.PI, Math.PI, 'xyz'], expected: [1, 0, 0, 0], },
{ args: [0, Math.PI, Math.PI, 'xzy'], expected: [-1, 0, 0, 0], },
{ args: [Math.PI, 0, Math.PI, 'xyz'], expected: [0, -1, 0, 0], },
{ args: [Math.PI, 0, Math.PI, 'zyx'], expected: [0, 1, 0, 0], },
{ args: [Math.PI, 0, Math.PI, 'zxy'], expected: [0, 1, 0, 0], },
{ args: [0.1, Math.PI, 0, 'zyx'], expected: [0, 0.9987502694129944, -0.04997916892170906, 0 ]},
];
for (const {args, expected} of tests) {
testQuatWithAndWithoutDest((...args) => {
return quat.fromEuler(...args);
}, expected, ...args);
}
const tests = [
{ args: [0, 0, 0, 'xyz'], expected: [0, 0, 0, 1], },
{ args: [Math.PI, 0, 0, 'xyz'], expected: [1, 0, 0, 0], },
{ args: [0, Math.PI, 0, 'xyz'], expected: [0, 1, 0, 0], },
{ args: [0, 0, Math.PI, 'xyz'], expected: [0, 0, 1, 0], },
{ args: [Math.PI, Math.PI, 0, 'xyz'], expected: [0, 0, 1, 0], },
{ args: [Math.PI, Math.PI, 0, 'yxz'], expected: [0, 0, -1, 0], },
{ args: [0, Math.PI, Math.PI, 'xyz'], expected: [1, 0, 0, 0], },
{ args: [0, Math.PI, Math.PI, 'xzy'], expected: [-1, 0, 0, 0], },
{ args: [Math.PI, 0, Math.PI, 'xyz'], expected: [0, -1, 0, 0], },
{ args: [Math.PI, 0, Math.PI, 'zyx'], expected: [0, 1, 0, 0], },
{ args: [Math.PI, 0, Math.PI, 'zxy'], expected: [0, 1, 0, 0], },
{ args: [0.1, Math.PI, 0, 'zyx'], expected: [0, 0.9987502694129944, -0.04997916892170906, 0 ]},
];
for (const {args, expected} of tests) {
testQuatWithAndWithoutDest((...args) => {
return quat.fromEuler(...args);
}, expected, ...args);
}