构建扇形清理剩余无效线段

pull/68/head
Zoe 6 years ago
parent 2a273fce5f
commit 53f92a3f95

@ -504,8 +504,7 @@ describe("补圆弧测试", () =>
{
expect(cus[0].GetOffsetCurves(-i).length).toBe(1);
}
//FIXME:没清理干净
// expect(cus[0].GetOffsetCurves(27.3).length).toBe(1);
expect(cus[0].GetOffsetCurves(27.3).length).toBe(1);
})
test("补圆弧测试3", () =>
{

@ -179,7 +179,7 @@ export class PolyOffestUtil
}
/**
* 线
* 2线
*
* @private
* @param {Curve} cu1
@ -187,7 +187,9 @@ export class PolyOffestUtil
* @returns
* @memberof PolyOffestUtil
*/
private BuildContour(cu1: Curve, cu2: Curve): Contour
private BuildContour(cu1: Curve, cu2: Curve | Vector3): Contour
{
if (cu2 instanceof Curve)
{
let l1 = new Line(cu1.StartPoint, cu2.StartPoint);
let l2 = new Line(cu1.EndPoint, cu2.EndPoint);
@ -219,6 +221,18 @@ export class PolyOffestUtil
l2
]);
}
else
{
let l1 = new Line(cu1.StartPoint, cu2);
let l2 = new Line(cu1.EndPoint, cu2);
return Contour.CreateContour([
cu1,
l1,
l2
]);
}
}
private BuildCircleContour(i: number | Vector3, cons: Contour[])
{
let center: Vector3;
@ -324,6 +338,18 @@ export class PolyOffestUtil
if (tPts.length > 0)//存在真交点情况下直接修剪
{
let iPt = this.selectFitInterPt(tPts, frontLine.EndPoint);
if (isFillArc)
{
//用丢失圆弧和交点构建扇形轮廓
for (let i = startIndex + 1; ; i++)
{
let index = FixIndex(i, this.m_PtCount);
let cu = this.m_Polyline.GetCurveAtParam(index);
cirContours.push(this.BuildContour(cu, iPt));
if (index === endIndex - 1) break;
}
}
this.appendNewCuAndContour(frontLine, nextStartPt, iPt, startIndex);
}
else if (isFillArc || iPts.length === 0)//连交点都没或者圆弧丢失补圆弧

Loading…
Cancel
Save