|
|
|
@ -1019,6 +1019,47 @@ export class Polyline extends Curve
|
|
|
|
|
|
|
|
|
|
return pl;
|
|
|
|
|
}
|
|
|
|
|
/**首尾相连的曲线直接连接 */
|
|
|
|
|
static FastCombine(curves: Curve[], tolerance = 1e-5): Polyline | undefined
|
|
|
|
|
{
|
|
|
|
|
if (!curves || curves.length === 0) return;
|
|
|
|
|
|
|
|
|
|
let pl = new Polyline;
|
|
|
|
|
pl.OCS = ComputerCurvesNormalOCS(curves);
|
|
|
|
|
|
|
|
|
|
let ocsInv = pl.OCSInv;
|
|
|
|
|
|
|
|
|
|
let lineData: PolylineProps[] = [];
|
|
|
|
|
for (let i = 0; i < curves.length; i++)
|
|
|
|
|
{
|
|
|
|
|
let cu = curves[i];
|
|
|
|
|
let bul = 0;
|
|
|
|
|
if (cu instanceof Arc)
|
|
|
|
|
bul = cu.Bul;
|
|
|
|
|
|
|
|
|
|
lineData.push({
|
|
|
|
|
pt: AsVector2(cu.StartPoint.applyMatrix4(ocsInv)),
|
|
|
|
|
bul
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (i === curves.length - 1)
|
|
|
|
|
{
|
|
|
|
|
lineData.push({
|
|
|
|
|
pt: AsVector2(cu.EndPoint.applyMatrix4(ocsInv)),
|
|
|
|
|
bul: 0
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (lineData.length > 1)
|
|
|
|
|
{
|
|
|
|
|
let ld = arrayLast(lineData).pt;
|
|
|
|
|
if (equalv2(lineData[0].pt, ld, tolerance))
|
|
|
|
|
ld.copy(lineData[0].pt);
|
|
|
|
|
}
|
|
|
|
|
pl.LineData = lineData;
|
|
|
|
|
return pl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PtOnCurve(pt: Vector3): boolean
|
|
|
|
|
{
|
|
|
|
|