完善直线的拉伸测试

pull/51/head
ChenX 7 years ago
parent 76486b4276
commit e03fd66f99

@ -1,5 +1,37 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`拉伸直线的夹点 1`] = `
Vector3 {
"x": 0,
"y": 10,
"z": 0,
}
`;
exports[`拉伸直线的夹点 2`] = `
Vector3 {
"x": 10,
"y": 5,
"z": 0,
}
`;
exports[`拉伸直线的夹点 3`] = `
Vector3 {
"x": 0,
"y": 10,
"z": 0,
}
`;
exports[`拉伸直线的夹点 4`] = `
Vector3 {
"x": 15,
"y": 5,
"z": 0,
}
`;
exports[`最近点 1`] = `
Vector3 {
"x": -2.5,

@ -128,3 +128,28 @@ test('最近点', () =>
expect(l.GetClosestPointTo(new Vector3(-5, 0, 0), false)/*?*/).toMatchSnapshot();//0,0,0.
});
test('拉伸直线的夹点', () =>
{
let line = new Line(new Vector3(0, 0, 0), new Vector3(10, 0, 0));
//测试拉伸一个参数
line.MoveStretchPoints([0], new Vector3(0, 5, 0));
expect(line.StartPoint.toArray()).toMatchObject([0, 5, 0]);
//测试同时拉伸2个点的情况下
line.MoveStretchPoints([0, 1], new Vector3(0, 5, 0));
expect(line.StartPoint /*?*/).toMatchSnapshot();
expect(line.EndPoint /*?*/).toMatchSnapshot();
line.MoveStretchPoints([1], new Vector3(5, 0, 0));
expect(line.StartPoint).toMatchSnapshot();
expect(line.EndPoint).toMatchSnapshot();
});

@ -204,6 +204,14 @@ export class Entity extends CADObject
{
return [];
}
/**
* ,Stretch
*
* @param {Array<number>} indexList .
* @param {THREE.Vector3} vec
* @memberof Entity
*/
MoveStretchPoints(indexList: Array<number>, vec: THREE.Vector3)
{

Loading…
Cancel
Save