A,B타입 보조선 두개이상 변경 시 이상 수정

This commit is contained in:
hyojun.choi 2026-06-17 14:33:42 +09:00
parent 7773e08617
commit 271c132bac

View File

@ -1528,14 +1528,20 @@ export const usePolygon = () => {
if (type !== 'eaves' && type !== 'gable' && type !== 'shed') return false if (type !== 'eaves' && type !== 'gable' && type !== 'shed') return false
const A = E.startPoint const A = E.startPoint
const B = E.endPoint const B = E.endPoint
// A·B 각각에서 바깥으로 뻗는 연결 보조선(한쪽 끝점만 공유) // 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)) // 못 찾으므로, 모든 CA×CB 조합을 시도해 "두 바깥 끝점을 잇는 평행 닫힘 보조선"이 있는 조합이
if (!CA || !CB) return false // 하나라도 있으면 띠로 인정한다.
// 두 연결선의 바깥 끝점을 잇는 평행 보조선(옮긴 처마)이 있어야 띠가 닫힌다 const candA = auxBandLines.filter((c) => c !== E && sharesPt(c, A) && !sharesPt(c, B))
const Ao = otherEnd(CA, A) const candB = auxBandLines.filter((c) => c !== E && sharesPt(c, B) && !sharesPt(c, A))
const Bo = otherEnd(CB, B) return candA.some((CA) =>
return auxBandLines.some((c) => c !== CA && c !== CB && sharesPt(c, Ao) && sharesPt(c, Bo)) 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) { if (supersededEaves.length > 0) {
logger.log(`[SUPERSEDED-EAVES] 띠로 대체된 원래 외곽선(처마/케라바) ${supersededEaves.length}개 면분할 입력에서 제외`) logger.log(`[SUPERSEDED-EAVES] 띠로 대체된 원래 외곽선(처마/케라바) ${supersededEaves.length}개 면분할 입력에서 제외`)