From 8ff2f0444215c8434cb100544816a62d5ea4fb6a Mon Sep 17 00:00:00 2001 From: ZoeLeeFZ Date: Mon, 19 Oct 2020 22:07:19 +0800 Subject: [PATCH] =?UTF-8?q?!1243=20=E4=BF=AE=E5=A4=8D:=E5=BC=82=E5=9E=8B?= =?UTF-8?q?=E8=A7=81=E5=85=89=E9=9D=A2=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Geometry/DrillParse/Face.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Geometry/DrillParse/Face.ts b/src/Geometry/DrillParse/Face.ts index be9f74bb6..2f72a09f0 100644 --- a/src/Geometry/DrillParse/Face.ts +++ b/src/Geometry/DrillParse/Face.ts @@ -7,6 +7,7 @@ import { Box3Ext } from "../Box"; import { equaln, XAxis } from "../GeUtils"; import { BoardFaceType } from "./BoardGetFace"; import { Polyline } from "../../DatabaseServices/Entity/Polyline"; +import { Contour } from "../../DatabaseServices/Contour"; export interface BoardFaceParams { @@ -161,7 +162,7 @@ export class Face //如果不是矩形,用布尔运算,如果 if (!noSideFace.IsRect || !canUseBoxCalc) { - let c1 = new Polyline().Rectangle(this.Length, this.Width); + let c1 = new Polyline().Rectangle(sideFace.Length, sideFace.Width); let c2 = noSideFace.LocalBoard.ContourCurve.Clone().ApplyMatrix(diffMtx); let box = c1.BoundingBox.intersect(c2.BoundingBox); @@ -170,12 +171,17 @@ export class Face if (equaln(size.x * size.y, 0)) return false; - let pts = c1.IntersectWith(c2, 0); - if (pts.length <= 1) return true; + let con1 = Contour.CreateContour(c1); + let con2 = Contour.CreateContour(c2); + let cs = con1.IntersectionBoolOperation(con2); - new Box3Ext().setFromPoints(pts).getSize(size); - - return size.x / sideFace.Length > fuzz; + for (let c of cs) + { + c.BoundingBox.getSize(size); + if (size.x / sideFace.Length > fuzz) + return true; + } + return false; } else {