|
|
@ -623,24 +623,30 @@ export class PolyOffestUtil2
|
|
|
|
{
|
|
|
|
{
|
|
|
|
contours.push(this.buildSealed(plList1[i].pl, plList2[i].pl));
|
|
|
|
contours.push(this.buildSealed(plList1[i].pl, plList2[i].pl));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// contours = Shape.mergeHoles(contours);
|
|
|
|
// contours = Shape.mergeContours(contours);
|
|
|
|
// let shapes = contours.map(c => new Shape(c));
|
|
|
|
// let shapes = contours.map(c => new Shape(c));
|
|
|
|
// let reg = new Region();
|
|
|
|
// let reg = new Region();
|
|
|
|
// reg.ShapeManager.AppendShapeList(shapes);
|
|
|
|
// reg.ShapeManager.AppendShapeList(shapes);
|
|
|
|
// app.m_Database.ModelSpace.Append(reg);
|
|
|
|
// app.m_Database.ModelSpace.Append(reg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contours.forEach(c =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
c.Outline.ColorIndex = 3;
|
|
|
|
|
|
|
|
app.m_Database.ModelSpace.Append(c.Outline);
|
|
|
|
|
|
|
|
})
|
|
|
|
let newProps = this.trimAndJointOffestPolyline(plList1, this.m_Polyline);
|
|
|
|
let newProps = this.trimAndJointOffestPolyline(plList1, this.m_Polyline);
|
|
|
|
// let refProps = this.trimAndJointOffestPolyline(plList2, this.m_Polyline);
|
|
|
|
let refProps = this.trimAndJointOffestPolyline(plList2, this.m_Polyline);
|
|
|
|
|
|
|
|
|
|
|
|
let newPl = new Polyline(newProps);
|
|
|
|
let newPl = new Polyline(newProps);
|
|
|
|
// let refPl = new Polyline(refProps);
|
|
|
|
let refPl = new Polyline(refProps);
|
|
|
|
|
|
|
|
|
|
|
|
// newPl.ColorIndex = 1;
|
|
|
|
// newPl.ColorIndex = 1;
|
|
|
|
// refPl.ColorIndex = 2;
|
|
|
|
// refPl.ColorIndex = 2;
|
|
|
|
|
|
|
|
// return [newPl, refPl]
|
|
|
|
|
|
|
|
|
|
|
|
// return [refPl, ...this.clipOffestPolyline(this.m_Polyline, newPl, refPl)]
|
|
|
|
// return [refPl, ...this.clipOffestPolyline(this.m_Polyline, newPl, refPl)]
|
|
|
|
// return this.clipOffestPolyline(this.m_Polyline, newPl, refPl);
|
|
|
|
// return this.clipOffestPolyline(this.m_Polyline, newPl, refPl);
|
|
|
|
// return [newPl]
|
|
|
|
// return [newPl]
|
|
|
|
return this.cutting(newPl, contours);
|
|
|
|
return [...this.cutting(newPl, contours), ...this.cutting(refPl, contours)];
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//偏移曲线
|
|
|
|
//偏移曲线
|
|
|
@ -1152,15 +1158,15 @@ export class PolyOffestUtil3
|
|
|
|
console.log(box, Math.sqrt(Math.pow(box.x, 2) + Math.pow(box.y, 2)) / 2);
|
|
|
|
console.log(box, Math.sqrt(Math.pow(box.x, 2) + Math.pow(box.y, 2)) / 2);
|
|
|
|
console.log('off', this.m_OffestDist);
|
|
|
|
console.log('off', this.m_OffestDist);
|
|
|
|
|
|
|
|
|
|
|
|
newPlList = this.cutting(newPlList, contours);
|
|
|
|
// newPlList = this.cutting(newPlList, contours);
|
|
|
|
testPlList = this.cutting(testPlList, contours);
|
|
|
|
// testPlList = this.cutting(testPlList, contours);
|
|
|
|
|
|
|
|
|
|
|
|
// 闭合时向内偏移,偏移线段应在封闭区域内
|
|
|
|
// // 闭合时向内偏移,偏移线段应在封闭区域内
|
|
|
|
if (this.m_Polyline.IsClose && this.offDir > 0)
|
|
|
|
// if (this.m_Polyline.IsClose && this.offDir > 0)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
// newPlList = newPlList.filter(pl => isTargetCurInSourceCur(this.m_Polyline, pl))
|
|
|
|
// // newPlList = newPlList.filter(pl => isTargetCurInSourceCur(this.m_Polyline, pl))
|
|
|
|
testPlList = testPlList.filter(pl => isTargetCurInSourceCur(this.m_Polyline, pl))
|
|
|
|
// testPlList = testPlList.filter(pl => isTargetCurInSourceCur(this.m_Polyline, pl))
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
// this.cuttingPolyLines(newPlList);
|
|
|
|
// this.cuttingPolyLines(newPlList);
|
|
|
|
// this.cuttingPolyLines(testPlList);
|
|
|
|
// this.cuttingPolyLines(testPlList);
|
|
|
|
return [...newPlList, ...testPlList];
|
|
|
|
return [...newPlList, ...testPlList];
|
|
|
|