|
|
@ -36,7 +36,6 @@ test("", () =>
|
|
|
|
|
|
|
|
|
|
|
|
//试着还原
|
|
|
|
//试着还原
|
|
|
|
orb.UpdateDirection(dir);
|
|
|
|
orb.UpdateDirection(dir);
|
|
|
|
console.log('dir: ', dir);
|
|
|
|
|
|
|
|
expect(equalv3(dir, dirc)).toBe(true);
|
|
|
|
expect(equalv3(dir, dirc)).toBe(true);
|
|
|
|
|
|
|
|
|
|
|
|
//试试新的
|
|
|
|
//试试新的
|
|
|
@ -46,7 +45,6 @@ test("", () =>
|
|
|
|
|
|
|
|
|
|
|
|
//试着还原
|
|
|
|
//试着还原
|
|
|
|
orb.UpdateDirection(dir);
|
|
|
|
orb.UpdateDirection(dir);
|
|
|
|
console.log('dir: ', dir);
|
|
|
|
|
|
|
|
expect(equalv3(dir, dirc)).toBe(true);
|
|
|
|
expect(equalv3(dir, dirc)).toBe(true);
|
|
|
|
|
|
|
|
|
|
|
|
dir.set(0, 0, -1);
|
|
|
|
dir.set(0, 0, -1);
|
|
|
@ -58,30 +56,19 @@ test("", () =>
|
|
|
|
|
|
|
|
|
|
|
|
//试着还原
|
|
|
|
//试着还原
|
|
|
|
orb.UpdateDirection(dir);
|
|
|
|
orb.UpdateDirection(dir);
|
|
|
|
console.log('dir: ', dir);
|
|
|
|
|
|
|
|
expect(equalv3(dir, dirc)).toBe(true);
|
|
|
|
expect(equalv3(dir, dirc)).toBe(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let newDir = orb.UpdateDirection();
|
|
|
|
let newDir = orb.UpdateDirection();
|
|
|
|
console.log('newDir: ', newDir);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let up = Orbit.ComputUpDirection(new THREE.Vector3(0, 0, 1));
|
|
|
|
let up = Orbit.ComputUpDirection(new THREE.Vector3(0, 0, 1));
|
|
|
|
expect(equalv3(up, new THREE.Vector3(0, 1, 0))).toBe(true);
|
|
|
|
expect(equalv3(up, new THREE.Vector3(0, 1, 0))).toBe(true);
|
|
|
|
|
|
|
|
|
|
|
|
Orbit.ComputUpDirection(new THREE.Vector3(0, 0, -1), up);
|
|
|
|
Orbit.ComputUpDirection(new THREE.Vector3(0, 0, -1), up);
|
|
|
|
console.log(up);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Orbit.ComputUpDirection(new THREE.Vector3(0, 0, 1), up);
|
|
|
|
Orbit.ComputUpDirection(new THREE.Vector3(0, 0, 1), up);
|
|
|
|
console.log(up);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Orbit.ComputUpDirection(new THREE.Vector3(1, 0, 0), up);
|
|
|
|
Orbit.ComputUpDirection(new THREE.Vector3(1, 0, 0), up);
|
|
|
|
|
|
|
|
|
|
|
|
let newD = orb.UpdateDirection();
|
|
|
|
let newD = orb.UpdateDirection();
|
|
|
|
console.log(newD);
|
|
|
|
|
|
|
|
expect(equalv3(newD, new THREE.Vector3(0, 0, -1))).toBe(true);
|
|
|
|
expect(equalv3(newD, new THREE.Vector3(0, 0, -1))).toBe(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -89,22 +76,16 @@ test("测试求向量", () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let dir = new THREE.Vector3(0, 0, 1);
|
|
|
|
let dir = new THREE.Vector3(0, 0, 1);
|
|
|
|
let up = Orbit.ComputUpDirection(dir);
|
|
|
|
let up = Orbit.ComputUpDirection(dir);
|
|
|
|
|
|
|
|
|
|
|
|
console.log(up);
|
|
|
|
|
|
|
|
expect(up).toMatchSnapshot();
|
|
|
|
expect(up).toMatchSnapshot();
|
|
|
|
|
|
|
|
|
|
|
|
Orbit.ComputUpDirection(dir, up);
|
|
|
|
Orbit.ComputUpDirection(dir, up);
|
|
|
|
console.log(up);
|
|
|
|
|
|
|
|
expect(up).toMatchSnapshot();
|
|
|
|
expect(up).toMatchSnapshot();
|
|
|
|
|
|
|
|
|
|
|
|
dir.z = -1;
|
|
|
|
dir.z = -1;
|
|
|
|
Orbit.ComputUpDirection(dir, up);
|
|
|
|
Orbit.ComputUpDirection(dir, up);
|
|
|
|
console.log('up: ', up);
|
|
|
|
|
|
|
|
expect(up).toMatchSnapshot();
|
|
|
|
expect(up).toMatchSnapshot();
|
|
|
|
|
|
|
|
|
|
|
|
dir.x = 1;
|
|
|
|
dir.x = 1;
|
|
|
|
console.log('dir: ', dir);
|
|
|
|
|
|
|
|
Orbit.ComputUpDirection(dir, up);
|
|
|
|
Orbit.ComputUpDirection(dir, up);
|
|
|
|
console.log('up: ', up);
|
|
|
|
|
|
|
|
expect(up).toMatchSnapshot();
|
|
|
|
expect(up).toMatchSnapshot();
|
|
|
|
})
|
|
|
|
})
|
|
|
|