|
|
|
@ -709,27 +709,27 @@ export class Polyline extends Curve
|
|
|
|
|
this.Update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MatrixAlignTo(toMatrix: Matrix4)
|
|
|
|
|
//const this
|
|
|
|
|
MatrixAlignTo2(toMatrix: Matrix4)
|
|
|
|
|
{
|
|
|
|
|
if (!matrixIsCoplane(this._Matrix, toMatrix, 1e-4))
|
|
|
|
|
return;
|
|
|
|
|
return this.PtsBuls;
|
|
|
|
|
|
|
|
|
|
this.WriteAllObjectRecord();
|
|
|
|
|
let m = matrixAlignCoordSys(this._Matrix, toMatrix);
|
|
|
|
|
|
|
|
|
|
let z1 = this.Normal;
|
|
|
|
|
let z2 = new Vector3().setFromMatrixColumn(toMatrix, 2);
|
|
|
|
|
let isMirror = equalv3(z1, z2.negate());
|
|
|
|
|
|
|
|
|
|
let pts: Vector2[] = [];
|
|
|
|
|
let buls: number[] = [];
|
|
|
|
|
for (let d of this.m_LineData)
|
|
|
|
|
{
|
|
|
|
|
let p = AsVector3(d.pt).applyMatrix4(m);
|
|
|
|
|
d.pt.x = p.x;
|
|
|
|
|
d.pt.y = p.y;
|
|
|
|
|
|
|
|
|
|
if (isMirror)
|
|
|
|
|
d.bul = -d.bul;
|
|
|
|
|
let p = AsVector2(AsVector3(d.pt).applyMatrix4(m));
|
|
|
|
|
pts.push(p);
|
|
|
|
|
buls.push(isMirror ? -d.bul : d.bul);
|
|
|
|
|
}
|
|
|
|
|
return { pts, buls };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Join(cu: Curve, allowGap = false, tolerance = 1e-4)
|
|
|
|
@ -819,14 +819,12 @@ export class Polyline extends Curve
|
|
|
|
|
{
|
|
|
|
|
if (cu.CloseMark) return Status.False;
|
|
|
|
|
|
|
|
|
|
cu.MatrixAlignTo(this.OCS);
|
|
|
|
|
|
|
|
|
|
let { pts, buls } = this.PtsBuls;
|
|
|
|
|
|
|
|
|
|
if (equalv3(cuSp, sp, tolerance))
|
|
|
|
|
{
|
|
|
|
|
cu.Reverse();
|
|
|
|
|
let cuPtsBul = cu.PtsBuls;
|
|
|
|
|
let cuPtsBul = cu.MatrixAlignTo2(this.OCS);
|
|
|
|
|
cuPtsBul.pts.pop();
|
|
|
|
|
cuPtsBul.buls.pop();
|
|
|
|
|
pts = cuPtsBul.pts.concat(pts);
|
|
|
|
@ -837,13 +835,13 @@ export class Polyline extends Curve
|
|
|
|
|
pts.pop();
|
|
|
|
|
buls.pop();
|
|
|
|
|
|
|
|
|
|
let cuPtsBul = cu.PtsBuls;
|
|
|
|
|
let cuPtsBul = cu.MatrixAlignTo2(this.OCS);
|
|
|
|
|
pts = pts.concat(cuPtsBul.pts);
|
|
|
|
|
buls = buls.concat(cuPtsBul.buls);
|
|
|
|
|
}
|
|
|
|
|
else if (equalv3(cuEp, sp, tolerance))
|
|
|
|
|
{
|
|
|
|
|
let cuPtsBul = cu.PtsBuls;
|
|
|
|
|
let cuPtsBul = cu.MatrixAlignTo2(this.OCS);
|
|
|
|
|
cuPtsBul.pts.pop();
|
|
|
|
|
cuPtsBul.buls.pop();
|
|
|
|
|
pts = cuPtsBul.pts.concat(pts);
|
|
|
|
@ -855,7 +853,7 @@ export class Polyline extends Curve
|
|
|
|
|
buls.pop();
|
|
|
|
|
|
|
|
|
|
cu.Reverse();
|
|
|
|
|
let cuPtsBul = cu.PtsBuls;
|
|
|
|
|
let cuPtsBul = cu.MatrixAlignTo2(this.OCS);
|
|
|
|
|
pts = pts.concat(cuPtsBul.pts);
|
|
|
|
|
buls = buls.concat(cuPtsBul.buls);
|
|
|
|
|
}
|
|
|
|
|