更新 获得相机up向量测试

pull/648850/MERGE
ChenX 7 years ago
parent 3fa928b2a5
commit f4605cf382

@ -0,0 +1,16 @@
import { getLoocAtUpVec, cZAxis } from "./../../src/Geometry/GeUtils"
import { Vector3 } from "three";
test('getLoocAtUpVec', () =>
{
//俯视图 0,1,0
expect(getLoocAtUpVec(new Vector3(0, 0, 1)) /*?*/).toMatchSnapshot();
//仰视图
expect(getLoocAtUpVec(new Vector3(0, 0, -1)) /*?*/).toMatchSnapshot();
//左视图
expect(getLoocAtUpVec(new Vector3(-1, 0, 0)) /*?*/).toMatchSnapshot();
//右视图
expect(getLoocAtUpVec(new Vector3(1, 0, 0)) /*?*/).toMatchSnapshot();
//前视图
expect(getLoocAtUpVec(new Vector3(0, 1, 0)) /*?*/).toMatchSnapshot();
});

@ -0,0 +1,41 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`getLoocAtUpVec 1`] = `
Vector3 {
"x": 0,
"y": 1,
"z": 0,
}
`;
exports[`getLoocAtUpVec 2`] = `
Vector3 {
"x": 0,
"y": -1,
"z": 0,
}
`;
exports[`getLoocAtUpVec 3`] = `
Vector3 {
"x": 0,
"y": 0,
"z": 1,
}
`;
exports[`getLoocAtUpVec 4`] = `
Vector3 {
"x": 0,
"y": 0,
"z": 1,
}
`;
exports[`getLoocAtUpVec 5`] = `
Vector3 {
"x": 0,
"y": -0,
"z": 1,
}
`;

@ -82,7 +82,7 @@ export function getLoocAtUpVec(dir: THREE.Vector3): THREE.Vector3
{
return new THREE.Vector3(0, 1, 0);
}
else if (norm.equals(cZAxis.clone().multiplyScalar(-1)))
else if (norm.equals(cZAxis.clone().negate()))
{
return new THREE.Vector3(0, -1, 0);
}

Loading…
Cancel
Save