修正直线获取最近点参数错误的问题,补充单元测试

pull/166/MERGE
ChenX 6 years ago
parent 8b262d2c68
commit 7ea9f0a093

@ -42,3 +42,10 @@ test('直线相交', () =>
pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendBoth);
expect(pts.length).toBe(1);
});
test('直线参数', () =>
{
let l1 = new Line(new Vector3(0, 0, 0), new Vector3(5, 5, 0));
expect(l1.GetClosestAtPoint(new Vector3(10, 10), false).param).toBe(1);
});

@ -203,7 +203,7 @@ export class Line extends Curve
else if (param > length)
{
closestPt = this.EndPoint;
param = 1;
param = length;
}
else
closestPt = sp.add(direction.multiplyScalar(param));

Loading…
Cancel
Save