diff --git a/__test__/Geometry/__snapshots__/arc.test.ts.snap b/__test__/Geometry/__snapshots__/arc.test.ts.snap index 1d3ac6fbc..6e602d2e2 100644 --- a/__test__/Geometry/__snapshots__/arc.test.ts.snap +++ b/__test__/Geometry/__snapshots__/arc.test.ts.snap @@ -70,6 +70,10 @@ exports[`圆弧合并 1`] = `1`; exports[`圆弧合并 2`] = `0.5`; +exports[`圆弧合并 3`] = `0.5`; + +exports[`圆弧合并 4`] = `0`; + exports[`最近点 1`] = ` Vector3 { "x": 0, diff --git a/__test__/Geometry/arc.test.ts b/__test__/Geometry/arc.test.ts index 36f04d79d..516248bf1 100644 --- a/__test__/Geometry/arc.test.ts +++ b/__test__/Geometry/arc.test.ts @@ -208,6 +208,13 @@ test('圆弧合并', () => expect(arc.StartAngle).toMatchSnapshot(); expect(arc.EndAngle).toMatchSnapshot(); + //终点在里面,起点在外面 + arc = new Arc(new Vector3(), 1, 0, 1).Reverse(); + arc2 = new Arc(new Vector3(), 1, 5, 0.5).Reverse(); + expect(arc.Join(arc2)).toBeTruthy(); + expect(arc.StartAngle).toMatchSnapshot(); + expect(arc.EndAngle).toMatchSnapshot(); + //包含. arc = new Arc(new Vector3(), 1, 0, 1).Reverse(); arc2 = new Arc(new Vector3(), 1, 5, 3); diff --git a/src/DatabaseServices/Arc.ts b/src/DatabaseServices/Arc.ts index 329803f86..292948873 100644 --- a/src/DatabaseServices/Arc.ts +++ b/src/DatabaseServices/Arc.ts @@ -322,20 +322,25 @@ export class Arc extends Curve this.ConverToCircle();//圆 else this.StartAngle = sa; - return true; } else if (equaln(ea, this.m_EndAngle))//this终点对终点 { if (saAllan > allAn) this.StartAngle = sa; - return true; } - - if (eaAllan < saAllan && saAllan < allAn) + else if (this.ParamOnCurve(this.GetParamAtAngle(sa))) + { + if (eaAllan < saAllan) + this.ConverToCircle(); + else if (eaAllan > allAn) + this.EndAngle = ea; + return true; + } + else if (this.ParamOnCurve(this.GetParamAtAngle(ea))) { - this.ConverToCircle();//圆 + this.StartAngle = sa; return true; } @@ -491,7 +496,7 @@ export class Arc extends Curve return this; } - FromThreePoint(pt1: Vector3, pt2: Vector3, pt3: Vector3) + FromThreePoint(pt1: Vector3, pt2: Vector3, pt3: Vector3) { if (!(pt1 && pt2 && pt3)) return;