[1514_1] fix — ㄹ자 다각형 처마→케라바 변경 시 내부 힙(H-3) 미생성 수정 #942

Merged
ysCha merged 1 commits from dev into dev-deploy 2026-07-01 17:11:39 +09:00
Showing only changes of commit ccbc61bf8d - Show all commits

View File

@ -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 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 distToEnd = Math.hypot(analyze.end.x - intersect.x, analyze.end.y - intersect.y)
const farEnd = distToStart >= distToEnd ? analyze.start : analyze.end 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({ newAnalysis.push({
start: { x: intersect.x, y: intersect.y }, start: { x: intersect.x, y: intersect.y },
end: { x: farEnd.x, y: farEnd.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) const length = Math.sqrt((points[0].x - points[1].x) ** 2 + (points[0].y - points[1].y) ** 2)
if (length < EPSILON) return if (length < EPSILON) return
const isDiagonal = Math.abs(points[0].x - points[1].x) >= 1 && Math.abs(points[0].y - points[1].y) >= 1 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( innerLines.push(
drawHipLine([points[0].x, points[0].y, points[1].x, points[1].y], canvas, roof, textMode, currentDegree, currentDegree), 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)), (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] ②원인: 벽취합 잔여 라인 연결성 판정값(순서 무관) if (dup) return
// 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 (startAnchored && endAnchored) { if (startAnchored && endAnchored) {
if (line.type === TYPES.RIDGE) { 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)) innerLines.push(drawRidgeLine([line.start.x, line.start.y, line.end.x, line.end.y], canvas, roof, textMode))
} else if (line.degree === 0) { } 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)) innerLines.push(drawRoofLine([line.start.x, line.start.y, line.end.x, line.end.y], canvas, roof, textMode))
} else { } 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)) 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,
// })
} }
}) })
} }