diff --git a/__test__/Interest/line.test.ts b/__test__/Interest/line.test.ts index 0d4799afb..90507c34f 100644 --- a/__test__/Interest/line.test.ts +++ b/__test__/Interest/line.test.ts @@ -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); +}); diff --git a/src/DatabaseServices/Line.ts b/src/DatabaseServices/Line.ts index 88dc99da4..27cc0e2c7 100644 --- a/src/DatabaseServices/Line.ts +++ b/src/DatabaseServices/Line.ts @@ -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));