修改直线圆弧连接方式,如果直线和圆弧都是正假交点,补圆弧,

pull/68/head
Zoe 6 years ago
parent 415c9e21d3
commit df1960f17e

@ -248,5 +248,28 @@ test('闭合多段线偏移测试8', () =>
expect(cus[0].GetOffsetCurves(15).length).toBe(1);
expect(cus[0].GetOffsetCurves(17.8).length).toBe(2);
expect(cus[0].GetOffsetCurves(19).length).toBe(3);
for (let i = 20; i <= 40; i++)
{
expect(cus[0].GetOffsetCurves(i).length).toBe(3);
}
for (let i = 41; i <= 44.3; i += 0.1)
{
expect(cus[0].GetOffsetCurves(i).length).toBe(2);
}
expect(cus[0].GetOffsetCurves(45).length).toBe(1);
for (let i = 48; i <= 200; i += 10)
{
expect(cus[0].GetOffsetCurves(i).length).toBe(0);
}
})
test('闭合多段线偏移测试9', () =>
{
let data =
[1, ["Polyline", 1, 1, 12283, false, 2, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2494.1602062139054, -154.37421492307953, 0, 1], 2, 4, [-835.9056689963722, -81.71614968554674], -1.404257507243489, [-2.5205246091134654, -224.3682931983378], -0.7704346688180675, [-677.9527382520764, -55.635630094036955], 0, [-835.9056689963722, -81.71614968554674], 0, false]];
let cus = loadFile(data);
//外偏移 -
//内偏移+
})

@ -100,10 +100,7 @@ export class PolyOffestUtil
if (c.IntersectWith(this.m_Polyline, IntersectOption.OnBothOperands).length !== 0)
return false;
//删除在反方向的无效线段
return this.CheckPointDir(c.StartPoint) || this.CheckPointDir(c.EndPoint);
// return this.CheckPointDist(c.StartPoint) && this.CheckPointDist(c.EndPoint)
// return (this.CheckPointDist(c.StartPoint) && this.CheckPointDist(c.EndPoint))
// && this.CheckPointDir(c.StartPoint);
return this.CheckPointDir(c.GetPointAtParam(0.5));
});
//处理自交的线段
@ -377,9 +374,16 @@ export class PolyOffestUtil
//剩下情况frontline不作处理加入结果数组,补一段直线连接前后线
let par2 = laterLine.GetParamAtPoint(intPt);
if (par1 > 1)
{
if (par2 > 1 && laterLine instanceof Arc)
{
this.fillArc(endIndex - 1, endIndex, nextPt, frontLine, laterLine);
}
else
{
this.appendNewCuAndContour(frontLine, nextPt, intPt, startIndex);
}
}
else if (frontLine instanceof Arc && par1 < 0 && par2 < 0)
{
this.appendNewCuAndContour(frontLine, nextPt, intPt, startIndex);

Loading…
Cancel
Save