From 1f1307221f986c909283e0c2c373448fb9fd05f5 Mon Sep 17 00:00:00 2001 From: Zoe Date: Wed, 20 Mar 2019 15:41:43 +0800 Subject: [PATCH] fixes #ISB4R --- __test__/EdgeSealing/EdgeSealing.test.ts | 11 +++++++++++ .../__snapshots__/EdgeSealing.test.ts.snap | 8 ++++++-- src/GraphicsSystem/CalcEdgeSealing.ts | 14 +++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/__test__/EdgeSealing/EdgeSealing.test.ts b/__test__/EdgeSealing/EdgeSealing.test.ts index 26d905f59..ec76d12de 100644 --- a/__test__/EdgeSealing/EdgeSealing.test.ts +++ b/__test__/EdgeSealing/EdgeSealing.test.ts @@ -79,3 +79,14 @@ test("异型板件,非常规坐标系", () => sealingSize = [10, 5, 5, 5, 10, 5]; testBrSealing(br, sealingSize); }) +test("异型板件,非相切圆弧", () => +{ + let data = + [1, "Board", 3, 2, 102, false, 1, 2, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 112.87179487179475, -263.53276353276357, 0, 1], 2, 1200, 600.0000000000001, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [300, 1200], -0.563703247863248, [0, 900], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 112.87179487179475, -263.53276353276357, 0, 1], 1, "右侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[{\"size\":1},{\"size\":2},{\"size\":3},{\"size\":4},{\"size\":5}],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0, 0] + //第3段为圆弧 + let br = LoadBoardsFromFileData(data)[0]; + let sealingSize = [1, 1, 1, 1, 1]; + testBrSealing(br, sealingSize); + sealingSize = [3, 5, 3, 3, 3]; + testBrSealing(br, sealingSize); +}) diff --git a/__test__/EdgeSealing/__snapshots__/EdgeSealing.test.ts.snap b/__test__/EdgeSealing/__snapshots__/EdgeSealing.test.ts.snap index 0182081f4..3eb9986f5 100644 --- a/__test__/EdgeSealing/__snapshots__/EdgeSealing.test.ts.snap +++ b/__test__/EdgeSealing/__snapshots__/EdgeSealing.test.ts.snap @@ -18,6 +18,10 @@ exports[`异型板件,常规坐标系 5`] = `2603082.551922608`; exports[`异型板件,非常规坐标系 1`] = `75939516.39226122`; -exports[`异型板件,非常规坐标系 2`] = `75852693.84266448`; +exports[`异型板件,非常规坐标系 2`] = `75863286.03232267`; -exports[`异型板件,非常规坐标系 3`] = `75675829.72975093`; +exports[`异型板件,非常规坐标系 3`] = `75694680.60847881`; + +exports[`异型板件,非相切圆弧 1`] = `635612.2751433643`; + +exports[`异型板件,非相切圆弧 2`] = `626242.2196800548`; diff --git a/src/GraphicsSystem/CalcEdgeSealing.ts b/src/GraphicsSystem/CalcEdgeSealing.ts index 47698ccc6..449edfa48 100644 --- a/src/GraphicsSystem/CalcEdgeSealing.ts +++ b/src/GraphicsSystem/CalcEdgeSealing.ts @@ -4,6 +4,7 @@ import { Polyline } from "../DatabaseServices/Polyline"; import { IntersectOption } from "./IntersectWith"; import { PolyOffsetUtil } from "./OffsetPolyline"; import { Line } from "../DatabaseServices/Line"; +import { isParallelTo } from "../Geometry/GeUtils"; /** *曲线列表分段 @@ -17,9 +18,20 @@ export function paragraphCulist(cus: Curve[]) //归类曲线,返回归类是否成功 const paragraph = (cu: Curve, originCu: Curve, cus: Curve[]) => { - if (usedCu.has(cu) || (cu instanceof Line && originCu instanceof Line)) + const cuIsLine = cu instanceof Line; + const originCuIsLine = originCu instanceof Line; + + if (usedCu.has(cu) || (cuIsLine && originCuIsLine)) return false; + if (originCuIsLine !== cuIsLine) + { + if (originCuIsLine && !isParallelTo(originCu.GetFistDeriv(0), cu.GetFistDeriv(0))) + return false; + if (cuIsLine && !isParallelTo(originCu.GetFistDeriv(1), cu.GetFistDeriv(0))) + return false; + } + cus.push(cu); usedCu.add(cu); return true;