!1353 优化:增加矩形变酒格容差

pull/1353/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent d581af319a
commit 69b7d1d783

@ -30,6 +30,7 @@ export interface IParsePlRes
isRo?: boolean; isRo?: boolean;
} }
export const R2WRTolerance = 1e-3;
/** /**
* *
@ -580,7 +581,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
{ {
let an = vecY.angleTo(XAxis); let an = vecY.angleTo(XAxis);
if (equaln(an, Math.PI / 4, 1e-5)) if (equaln(an, Math.PI / 4, R2WRTolerance))
{ {
pts.sort((p1, p2) => p2.x - p1.x); pts.sort((p1, p2) => p2.x - p1.x);
return { return {
@ -594,7 +595,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
isRo: true, isRo: true,
}; };
} }
else if (equaln(an, 3 * Math.PI / 4, 1e-5)) else if (equaln(an, 3 * Math.PI / 4, R2WRTolerance))
{ {
pts.sort((p1, p2) => p1.y - p2.y); pts.sort((p1, p2) => p1.y - p2.y);
return { return {
@ -608,7 +609,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
isRo: true, isRo: true,
}; };
} }
else if (isParallelTo(vecX, XAxis)) else if (isParallelTo(vecX, XAxis, R2WRTolerance))
{ {
return { return {
isOk: true, isOk: true,
@ -622,7 +623,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
isRo: false, isRo: false,
}; };
} }
else if (isParallelTo(vecX, YAxis)) else if (isParallelTo(vecX, YAxis, R2WRTolerance))
{ {
return { return {
isOk: true, isOk: true,
@ -694,7 +695,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
} }
} }
arraySortByNumber(dists); arraySortByNumber(dists);
arrayRemoveDuplicateBySort(dists, equaln); arrayRemoveDuplicateBySort(dists, (n1, n2) => equaln(n1, n2, R2WRTolerance));
let pl = this.GetPolyline(d, dists, cof); let pl = this.GetPolyline(d, dists, cof);
if (pl) if (pl)

Loading…
Cancel
Save