From ccbc61bf8de2bc746972d5480369b94dea3f9bfc Mon Sep 17 00:00:00 2001 From: ysCha Date: Wed, 1 Jul 2026 17:01:53 +0900 Subject: [PATCH] =?UTF-8?q?[1514=5F1]=20fix=20=E2=80=94=20=E3=84=B9?= =?UTF-8?q?=EC=9E=90=20=EB=8B=A4=EA=B0=81=ED=98=95=20=EC=B2=98=EB=A7=88?= =?UTF-8?q?=E2=86=92=EC=BC=80=EB=9D=BC=EB=B0=94=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EC=8B=9C=20=EB=82=B4=EB=B6=80=20=ED=9E=99(H-3)=20=EB=AF=B8?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit proceedAnalysis 잔여 병합 same-direction else 분기의 45° hip 판정 버그 수정. points 는 점 객체 2개 배열인데 points[0]-points[2](없는 인덱스, 객체 뺄셈→NaN)를 points[0].x/y - points[1].x/y 로 교정 → 대각 hip 정상 생성 확인. Co-Authored-By: Claude Opus 4 --- src/util/qpolygon-utils.js | 52 +++----------------------------------- 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/src/util/qpolygon-utils.js b/src/util/qpolygon-utils.js index e9e32f52..30c98824 100644 --- a/src/util/qpolygon-utils.js +++ b/src/util/qpolygon-utils.js @@ -4850,19 +4850,6 @@ export const drawRoofByAttribute = (roofId, canvas, textMode) => { const distToStart = Math.hypot(analyze.start.x - intersect.x, analyze.start.y - intersect.y) const distToEnd = Math.hypot(analyze.end.x - intersect.x, analyze.end.y - intersect.y) const farEnd = distToStart >= distToEnd ? analyze.start : analyze.end - // [KERAB-GABLE-DIAG 2026-06-29] ③분기→④결과: 연결점 기존 analyze 라인 교체 — far-end 보존으로 붕괴 방지 검증 - // const __newLen = Math.round(Math.hypot(farEnd.x - intersect.x, farEnd.y - intersect.y) * 10) / 10 - // debugCapture.log('KERAB-GABLE-DIAG ③분기:loop-analyze-replace → ④결과:' + (__newLen < 0.05 ? 'COLLAPSE-len0' : 'replaced-farEnd'), { - // iter: iterations, - // replacedType: analyze.type, - // replacedLeft: analyze.left, - // replacedRight: analyze.right, - // origStart: { x: Math.round(analyze.start.x * 10) / 10, y: Math.round(analyze.start.y * 10) / 10 }, - // origEnd: { x: Math.round(analyze.end.x * 10) / 10, y: Math.round(analyze.end.y * 10) / 10 }, - // intersect: { x: Math.round(intersect.x * 10) / 10, y: Math.round(intersect.y * 10) / 10 }, - // farEnd: { x: Math.round(farEnd.x * 10) / 10, y: Math.round(farEnd.y * 10) / 10 }, - // newLen: __newLen, - // }) newAnalysis.push({ start: { x: intersect.x, y: intersect.y }, end: { x: farEnd.x, y: farEnd.y }, @@ -5034,7 +5021,9 @@ export const drawRoofByAttribute = (roofId, canvas, textMode) => { const length = Math.sqrt((points[0].x - points[1].x) ** 2 + (points[0].y - points[1].y) ** 2) if (length < EPSILON) return const isDiagonal = Math.abs(points[0].x - points[1].x) >= 1 && Math.abs(points[0].y - points[1].y) >= 1 - if (isDiagonal && almostEqual(Math.abs(points[0] - points[2]), Math.abs(points[1] - points[3]))) { + // points 는 점 객체 2개 배열이므로 45°(|dx|≈|dy|) 판정은 .x/.y 로 계산해야 한다. + // (기존 points[0]-points[2] 는 존재하지 않는 인덱스 간 객체 뺄셈 → NaN → 대각 hip 이 항상 미생성되던 버그) + if (isDiagonal && almostEqual(Math.abs(points[0].x - points[1].x), Math.abs(points[0].y - points[1].y))) { innerLines.push( drawHipLine([points[0].x, points[0].y, points[1].x, points[1].y], canvas, roof, textMode, currentDegree, currentDegree), ) @@ -5079,49 +5068,16 @@ export const drawRoofByAttribute = (roofId, canvas, textMode) => { (almostEqual(il.x1, line.end.x, SHARED_EPS) && almostEqual(il.y1, line.end.y, SHARED_EPS) && almostEqual(il.x2, line.start.x, SHARED_EPS) && almostEqual(il.y2, line.start.y, SHARED_EPS)), ) - // [KERAB-GABLE-DIAG 2026-06-29] ②원인: 벽취합 잔여 라인 연결성 판정값(순서 무관) - // debugCapture.log('KERAB-GABLE-DIAG ②원인:wall-merge-residual', { - // type: line.type, - // degree: line.degree, - // baseLinesLen: baseLines.length, - // startOnLine: !!startOnLine, - // endOnLine: !!endOnLine, - // start: { x: Math.round(line.start.x * 10) / 10, y: Math.round(line.start.y * 10) / 10 }, - // end: { x: Math.round(line.end.x * 10) / 10, y: Math.round(line.end.y * 10) / 10 }, - // startShared: sharedCnt(line.start), - // endShared: sharedCnt(line.end), - // startAnchored, - // endAnchored, - // dup: !!dup, - // }) - - if (dup) { - // [KERAB-GABLE-DIAG 2026-06-29] ③분기→④결과: 이미 그려진 동일 라인 → 중복 스킵 - // debugCapture.log('KERAB-GABLE-DIAG ③분기:duplicate → ④결과:skipped', { type: line.type }) - return - } + if (dup) return if (startAnchored && endAnchored) { if (line.type === TYPES.RIDGE) { - // [KERAB-GABLE-DIAG 2026-06-29] ③분기→④결과: 양끝 연결된 RIDGE → 마루 그림 - // debugCapture.log('KERAB-GABLE-DIAG ③분기:anchored-ridge → ④결과:ridge-drawn', { type: line.type }) innerLines.push(drawRidgeLine([line.start.x, line.start.y, line.end.x, line.end.y], canvas, roof, textMode)) } else if (line.degree === 0) { - // [KERAB-GABLE-DIAG 2026-06-29] ③분기→④결과: 양끝 연결 + degree0 → roofLine 그림 - // debugCapture.log('KERAB-GABLE-DIAG ③분기:anchored-degree0 → ④결과:roofLine-drawn', { type: line.type, degree: line.degree }) innerLines.push(drawRoofLine([line.start.x, line.start.y, line.end.x, line.end.y], canvas, roof, textMode)) } else { - // [KERAB-GABLE-DIAG 2026-06-29] ③분기→④결과: 양끝 연결 + degree>0 → hip 그림 - // debugCapture.log('KERAB-GABLE-DIAG ③분기:anchored-hip → ④결과:hip-drawn', { type: line.type, degree: line.degree }) innerLines.push(drawHipLine([line.start.x, line.start.y, line.end.x, line.end.y], canvas, roof, textMode, line.degree, line.degree)) } - } else { - // [KERAB-GABLE-DIAG 2026-06-29] ③분기→④결과: 한쪽 끝이 고립(연결 안됨) → 소멸 - // debugCapture.log('KERAB-GABLE-DIAG ③분기:not-anchored → ④결과:dropped', { - // type: line.type, - // startAnchored, - // endAnchored, - // }) } }) } -- 2.47.2