还原原先的在端点上的代码,使测试通过.

pull/75/head
ChenX_AMD 6 years ago
parent 9c856f5404
commit fa5ba4e63b

@ -70,6 +70,10 @@ exports[`圆弧合并 1`] = `1`;
exports[`圆弧合并 2`] = `0.5`;
exports[`圆弧合并 3`] = `0.5`;
exports[`圆弧合并 4`] = `0`;
exports[`最近点 1`] = `
Vector3 {
"x": 0,

@ -212,6 +212,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);
@ -288,3 +295,5 @@ test('容差相接', () =>
expect(arc.AllAngle).toBe(Math.PI * 2);
});
//file.only

@ -300,26 +300,47 @@ export class Arc extends Curve
let saAllan = this.ComputeAnlge(sa);
let eaAllan = this.ComputeAnlge(ea);
if (this.ParamOnCurve(this.GetParamAtAngle(ea)))//this终点对终
if (equaln(sa, this.m_StartAngle)) //this起点对起
{
if (eaAllan < saAllan || equaln(sa, this.m_StartAngle))
if (eaAllan > allAn)
this.EndAngle = ea;
return true;
}
else if (equaln(sa, this.m_EndAngle))//this终点对起点
{
if (eaAllan < allAn || equaln(ea, this.m_StartAngle))
this.ConverToCircle();//圆
else if (saAllan > allAn)
this.StartAngle = sa;
else
this.EndAngle = ea;
return true;
}
else if (this.ParamOnCurve(this.GetParamAtAngle(sa))) //this起点对起点
else if (equaln(ea, this.StartAngle))//this起点对终
{
if (eaAllan < allAn)
if (saAllan < allAn)
this.ConverToCircle();//圆
else
this.StartAngle = sa;
return true;
}
else if (equaln(ea, this.m_EndAngle))//this终点对终点
{
if (saAllan > allAn)
this.StartAngle = sa;
return true;
}
else if (this.ParamOnCurve(this.GetParamAtAngle(sa)))
{
if (eaAllan < saAllan)
this.ConverToCircle();
else if (eaAllan > allAn)
this.EndAngle = ea;
return true;
}
if (eaAllan < saAllan && saAllan < allAn)
else if (this.ParamOnCurve(this.GetParamAtAngle(ea)))
{
this.ConverToCircle();//圆
this.StartAngle = sa;
return true;
}

Loading…
Cancel
Save