From 777f85f5b63840d913112c9d3bfb9c2bd8fb9c17 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Wed, 17 Jun 2026 14:34:07 +0900 Subject: [PATCH] =?UTF-8?q?A,B=ED=83=80=EC=9E=85=20=EB=B3=B4=EC=A1=B0?= =?UTF-8?q?=EC=84=A0=20=EB=91=90=EA=B0=9C=EC=9D=B4=EC=83=81=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EC=8B=9C=20=EC=9D=B4=EC=83=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/usePolygon.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/hooks/usePolygon.js b/src/hooks/usePolygon.js index 75895e22..cd2c9b3f 100644 --- a/src/hooks/usePolygon.js +++ b/src/hooks/usePolygon.js @@ -1522,14 +1522,20 @@ export const usePolygon = () => { if (type !== 'eaves' && type !== 'gable' && type !== 'shed') return false const A = E.startPoint const B = E.endPoint - // A·B 각각에서 바깥으로 뻗는 연결 보조선(한쪽 끝점만 공유) - const CA = auxBandLines.find((c) => c !== E && sharesPt(c, A) && !sharesPt(c, B)) - const CB = auxBandLines.find((c) => c !== E && c !== CA && sharesPt(c, B) && !sharesPt(c, A)) - if (!CA || !CB) return false - // 두 연결선의 바깥 끝점을 잇는 평행 보조선(옮긴 처마)이 있어야 띠가 닫힌다 - const Ao = otherEnd(CA, A) - const Bo = otherEnd(CB, B) - return auxBandLines.some((c) => c !== CA && c !== CB && sharesPt(c, Ao) && sharesPt(c, Bo)) + // A·B 각각에서 바깥으로 뻗는 연결 보조선 후보(한쪽 끝점만 공유). 한 끝점에 여러 개일 수 있다 + // (스텝 이동: 중점에 좌·우 띠로 가는 대각이 둘 다 붙음). 첫 매치만 쓰면 잘못된 짝을 골라 닫힘선을 + // 못 찾으므로, 모든 CA×CB 조합을 시도해 "두 바깥 끝점을 잇는 평행 닫힘 보조선"이 있는 조합이 + // 하나라도 있으면 띠로 인정한다. + const candA = auxBandLines.filter((c) => c !== E && sharesPt(c, A) && !sharesPt(c, B)) + const candB = auxBandLines.filter((c) => c !== E && sharesPt(c, B) && !sharesPt(c, A)) + return candA.some((CA) => + candB.some((CB) => { + if (CA === CB) return false + const Ao = otherEnd(CA, A) + const Bo = otherEnd(CB, B) + return auxBandLines.some((c) => c !== CA && c !== CB && sharesPt(c, Ao) && sharesPt(c, Bo)) + }), + ) }) if (supersededEaves.length > 0) { logger.log(`[SUPERSEDED-EAVES] 띠로 대체된 원래 외곽선(처마/케라바) ${supersededEaves.length}개 면분할 입력에서 제외`)