혹장 계산 roofLine #747

Merged
ysCha merged 1 commits from dev into dev-deploy 2026-04-01 18:37:43 +09:00

View File

@ -991,7 +991,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
newPStart.y = wallBaseLine.y1
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'left_in_start' })
const newPointX = Big(roofLine.x1).plus(moveDist).abs().toNumber()
let newPointX = Big(roofLine.x1).plus(moveDist).abs().toNumber()
const pDist = Big(wallLine.x1).minus(roofLine.x1).toNumber()
const pLineY = Big(roofLine.y1).minus(0).abs().toNumber()
// let idx = 0 > index - 1 ? sortRoofLines.length : index
@ -1005,8 +1005,14 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
// getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: newPointX, y: roofLine.y2 }, 'orange')
if (Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: newPointX, y: pLineY }, 'green')
getAddLine({ x: newPointX, y: pLineY }, { x: ePoint.x, y: ePoint.y }, 'pink')
// Validate: newPointX should not cross over pLineX (adjacent line)
if (newPointX > pLineX) {
console.warn('⚠️ [LEFT_IN_START] Line crossing detected! newPointX:', newPointX, 'exceeds pLineX:', pLineX, '| Clamping to prevent overlap')
newPointX = pLineX
} else {
getAddLine({ x: pLineX, y: pLineY }, { x: newPointX, y: pLineY }, 'green')
getAddLine({ x: newPointX, y: pLineY }, { x: ePoint.x, y: ePoint.y }, 'pink')
}
}
getAddLine(newPStart, newPEnd, 'red')
@ -1022,7 +1028,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
newPEnd.y = wallBaseLine.y2
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'left_in_end' })
const newPointX = Big(roofLine.x1).plus(moveDist).toNumber()
let newPointX = Big(roofLine.x1).plus(moveDist).toNumber()
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
const pLineY = Big(roofLine.y2).minus(0).toNumber()
// let idx = sortRoofLines.length < index + 1 ? 0 : index
@ -1036,14 +1042,84 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
// getAddLine({ x: roofLine.x1, y: roofLine.y1 }, { x: newPointX, y: roofLine.y1 }, 'orange')
if (Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: newPointX, y: pLineY }, 'green')
getAddLine({ x: newPointX, y: pLineY }, { x: ePoint.x, y: ePoint.y }, 'pink')
// Validate: newPointX should not cross over pLineX (adjacent line)
if (newPointX > pLineX) {
console.warn('⚠️ [LEFT_IN_END] Line crossing detected! newPointX:', newPointX, 'exceeds pLineX:', pLineX, '| Clamping to prevent overlap')
newPointX = pLineX
} else {
getAddLine({ x: pLineX, y: pLineY }, { x: newPointX, y: pLineY }, 'green')
getAddLine({ x: newPointX, y: pLineY }, { x: ePoint.x, y: ePoint.y }, 'pink')
}
}
//getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: newPointX, y: roofLine.y2 }, 'orange')
getAddLine(newPStart, newPEnd, 'red')
}
if(!isStartEnd.start && !isStartEnd.end){
console.log('left_in::::isStartEnd:::::', isStartEnd)
const moveDistY1 = Big(roofLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const moveDistX1 = Big(roofLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const moveDistX2 = Big(roofLine.x2).minus(wallBaseLine.x2).abs().toNumber()
const moveDistY2 = Big(roofLine.y2).minus(wallBaseLine.y2).abs().toNumber()
const sPoint = { x: wallBaseLine.x1, y: wallBaseLine.y1 }
const ePoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
if(moveDistY1 > 0) {
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'left_in_start' })
if(moveDistY1 > moveDistX1){
const dist = moveDistY1 - moveDistX1
// console.log('Creating extensionLine (Y1 > X1):', { sPoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: sPoint.x, y: sPoint.y }, { x: roofLine.x1, y: roofLine.y1 + dist }, 'orange','extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}else{
const dist = moveDistX1 - moveDistY1
// console.log('Creating extensionLine (X1 > Y1):', { sPoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: sPoint.x, y: sPoint.y }, { x: roofLine.x1 + dist, y: roofLine.y1 }, 'orange','extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}
}
if(moveDistY2 > 0) {
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'left_in_end' })
if(moveDistY2 > moveDistX2){
const dist = moveDistY2 - moveDistX2
// getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: roofLine.x2, y: roofLine.y2 - dist }, 'red')
// console.log('Creating extensionLine (Y2 > X2):', { ePoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: ePoint.x, y: ePoint.y }, { x: roofLine.x2, y: roofLine.y2 - dist }, 'orange', 'extensionLine')
console.log('extensionLine created1 - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}else{
const dist = moveDistX2 - moveDistY2
// getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: roofLine.x2 - dist, y: roofLine.y2 }, 'red')
// console.log('Creating extensionLine (X2 > Y2):', { ePoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: ePoint.x, y: ePoint.y }, { x: roofLine.x2 + dist, y: roofLine.y2 }, 'orange', 'extensionLine')
console.log('extensionLine created2 - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}
}
}
} else if (condition === 'left_out') {
console.log('left_out::::isStartEnd:::::', isStartEnd)
if (isStartEnd.start) {
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const aStartY = Big(roofLine.y1).minus(moveDist).abs().toNumber()
@ -1103,7 +1179,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
if (isStartEnd.end) {
console.log('left_in::::isStartEnd:::::', isStartEnd)
console.log('left_out::::isStartEnd:::::', isStartEnd)
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const aStartY = Big(roofLine.y2).plus(moveDist).toNumber()
const bStartY = Big(wallLine.y2).plus(moveDist).toNumber()
@ -1163,7 +1239,9 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
findPoints.push({ y: newPStart.y, x: newPEnd.x, position: 'left_out_end' })
getAddLine(newPStart, newPEnd, 'red')
}
} else if (condition === 'right_in') {
if (isStartEnd.start) {
console.log('right_in::::isStartEnd:::::', isStartEnd)
newPEnd.y = roofLine.y2
@ -1174,7 +1252,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
newPStart.y = wallBaseLine.y1
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'right_in_start' })
const newPointX = Big(roofLine.x1).minus(moveDist).abs().toNumber()
let newPointX = Big(roofLine.x1).minus(moveDist).abs().toNumber()
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
const pLineY = Big(roofLine.y1).minus(0).abs().toNumber()
// let idx = 0 >= index - 1 ? sortRoofLines.length : index
@ -1188,8 +1266,14 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
//getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: newPointX, y: roofLine.y2 }, 'orange')
if (Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: newPointX, y: pLineY }, 'green')
getAddLine({ x: newPointX, y: pLineY }, { x: ePoint.x, y: ePoint.y }, 'pink')
// Validate: newPointX should not cross over pLineX (adjacent line)
if (newPointX < pLineX) {
console.warn('⚠️ [RIGHT_IN_START] Line crossing detected! newPointX:', newPointX, 'is less than pLineX:', pLineX, '| Clamping to prevent overlap')
newPointX = pLineX
} else {
getAddLine({ x: pLineX, y: pLineY }, { x: newPointX, y: pLineY }, 'green')
getAddLine({ x: newPointX, y: pLineY }, { x: ePoint.x, y: ePoint.y }, 'pink')
}
}
getAddLine(newPStart, newPEnd, 'red')
}
@ -1204,7 +1288,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
newPEnd.y = wallBaseLine.y2
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'right_in_end' })
const newPointX = Big(roofLine.x1).minus(moveDist).toNumber()
let newPointX = Big(roofLine.x1).minus(moveDist).toNumber()
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
// let idx = sortRoofLines.length < index + 1 ? 0 : index
@ -1218,12 +1302,82 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
//getAddLine({ x: roofLine.x1, y: Big(roofLine.y1).minus(moveDist).toNumber() }, { x: newPointX, y: Big(roofLine.y1).minus(moveDist).toNumber()}, 'orange')
if (Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: newPointX, y: pLineY }, 'green')
getAddLine({ x: newPointX, y: pLineY }, { x: ePoint.x, y: ePoint.y }, 'pink')
// Validate: newPointX should not cross over pLineX (adjacent line)
if (newPointX < pLineX) {
console.warn('⚠️ [RIGHT_IN_END] Line crossing detected! newPointX:', newPointX, 'is less than pLineX:', pLineX, '| Clamping to prevent overlap')
newPointX = pLineX
} else {
getAddLine({ x: pLineX, y: pLineY }, { x: newPointX, y: pLineY }, 'green')
getAddLine({ x: newPointX, y: pLineY }, { x: ePoint.x, y: ePoint.y }, 'pink')
}
}
//getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: newPointX, y: roofLine.y2 }, 'orange')
getAddLine(newPStart, newPEnd, 'red')
}
if(!isStartEnd.start && !isStartEnd.end){
console.log('right_in::::isStartEnd:::::', isStartEnd)
const moveDistY1 = Big(roofLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const moveDistX1 = Big(roofLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const moveDistX2 = Big(roofLine.x2).minus(wallBaseLine.x2).abs().toNumber()
const moveDistY2 = Big(roofLine.y2).minus(wallBaseLine.y2).abs().toNumber()
const sPoint = { x: wallBaseLine.x1, y: wallBaseLine.y1 }
const ePoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
if(moveDistY1 > 0) {
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'right_in_start' })
if(moveDistY1 > moveDistX1){
const dist = moveDistY1 - moveDistX1
// console.log('Creating extensionLine (Y1 > X1):', { sPoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: sPoint.x, y: sPoint.y }, { x: roofLine.x1, y: roofLine.y1 + dist }, 'orange','extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}else{
const dist = moveDistX1 - moveDistY1
// console.log('Creating extensionLine (X1 > Y1):', { sPoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: sPoint.x, y: sPoint.y }, { x: roofLine.x1 - dist, y: roofLine.y1 }, 'orange','extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}
}
if(moveDistY2 > 0) {
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'right_in_end' })
if(moveDistY2 > moveDistX2){
const dist = moveDistY2 - moveDistX2
// getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: roofLine.x2, y: roofLine.y2 - dist }, 'red')
// console.log('Creating extensionLine (Y2 > X2):', { ePoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: ePoint.x, y: ePoint.y }, { x: roofLine.x2, y: roofLine.y2 - dist }, 'orange', 'extensionLine')
console.log('extensionLine created1 - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}else{
const dist = moveDistX2 - moveDistY2
// getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: roofLine.x2 - dist, y: roofLine.y2 }, 'red')
// console.log('Creating extensionLine (X2 > Y2):', { ePoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: ePoint.x, y: ePoint.y }, { x: roofLine.x2 - dist, y: roofLine.y2 }, 'orange', 'extensionLine')
console.log('extensionLine created2 - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}
}
}
} else if (condition === 'right_out') {
console.log('right_out::::isStartEnd:::::', isStartEnd)
if (isStartEnd.start) {
@ -1370,7 +1524,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
sPoint = { x: wallBaseLine.x1, y: wallBaseLine.y1 }
newPStart.x = wallBaseLine.x1
const newPointY = Big(roofLine.y2).plus(moveDist).toNumber()
let newPointY = Big(roofLine.y2).plus(moveDist).toNumber()
const pDist = Big(wallLine.y2).minus(roofLine.y2).abs().toNumber()
const pLineX = Big(roofLine.x1).minus(0).toNumber()
@ -1386,8 +1540,14 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'top_in_start' })
if (Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
getAddLine({ x: pLineX, y: newPointY }, { x: sPoint.x, y: sPoint.y }, 'pink')
// Validate: newPointY should not cross over pLineY (adjacent line)
if (newPointY > pLineY) {
console.warn('⚠️ [TOP_IN_START] Line crossing detected! newPointY:', newPointY, 'exceeds pLineY:', pLineY, '| Clamping to prevent overlap')
newPointY = pLineY
} else {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
getAddLine({ x: pLineX, y: newPointY }, { x: sPoint.x, y: sPoint.y }, 'pink')
}
}
//getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: roofLine.x2, y: newPointY }, 'orange')
getAddLine(newPStart, newPEnd, 'red')
@ -1399,7 +1559,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
sPoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
newPEnd.x = wallBaseLine.x2
const newPointY = Big(roofLine.y1).plus(moveDist).toNumber()
let newPointY = Big(roofLine.y1).plus(moveDist).toNumber()
const pDist = Big(wallLine.y1).minus(roofLine.y1).abs().toNumber()
const pLineX = Big(roofLine.x2).minus(0).toNumber()
@ -1415,20 +1575,27 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'top_in_end' })
if (Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
getAddLine({ x: pLineX, y: newPointY }, { x: sPoint.x, y: sPoint.y }, 'pink')
// Validate: newPointY should not cross over pLineY (adjacent line)
if (newPointY > pLineY) {
console.warn('⚠️ [TOP_IN_END] Line crossing detected! newPointY:', newPointY, 'exceeds pLineY:', pLineY, '| Clamping to prevent overlap')
newPointY = pLineY
} else {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
getAddLine({ x: pLineX, y: newPointY }, { x: sPoint.x, y: sPoint.y }, 'pink')
}
}
//getAddLine({ x: roofLine.x1, y: roofLine.y1 }, { x: roofLine.x1, y: newPointY }, 'orange')
getAddLine(newPStart, newPEnd, 'red')
}
if(!isStartEnd.start && !isStartEnd.end){
console.log('top_in start and end false')
const moveDistY1 = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const moveDistX1 = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const moveDistX2 = Big(wallLine.x2).minus(wallBaseLine.x2).abs().toNumber()
const moveDistY2 = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
const moveDistY1 = Big(roofLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const moveDistX1 = Big(roofLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const moveDistX2 = Big(roofLine.x2).minus(wallBaseLine.x2).abs().toNumber()
const moveDistY2 = Big(roofLine.y2).minus(wallBaseLine.y2).abs().toNumber()
const sPoint = { x: wallBaseLine.x1, y: wallBaseLine.y1 }
const ePoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
@ -1609,7 +1776,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
sPoint = { x: wallBaseLine.x1, y: wallBaseLine.y1 }
newPStart.x = wallBaseLine.x1
const newPointY = Big(roofLine.y2).minus(moveDist).toNumber()
let newPointY = Big(roofLine.y2).minus(moveDist).toNumber()
const pDist = Big(wallLine.y2).minus(roofLine.y2).abs().toNumber()
const pLineX = Big(roofLine.x1).minus(0).toNumber()
@ -1625,8 +1792,14 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'bottom_in_start' })
if (Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
getAddLine({ x: pLineX, y: newPointY }, { x: sPoint.x, y: sPoint.y }, 'pink')
// Validate: newPointY should not cross over pLineY (adjacent line)
if (newPointY < pLineY) {
console.warn('⚠️ [BOTTOM_IN_START] Line crossing detected! newPointY:', newPointY, 'is less than pLineY:', pLineY, '| Clamping to prevent overlap')
newPointY = pLineY
} else {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
getAddLine({ x: pLineX, y: newPointY }, { x: sPoint.x, y: sPoint.y }, 'pink')
}
}
//getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: roofLine.x2, y: newPointY }, 'orange')
getAddLine(newPStart, newPEnd, 'red')
@ -1638,7 +1811,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
sPoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
newPEnd.x = wallBaseLine.x2
const newPointY = Big(roofLine.y1).minus(moveDist).toNumber()
let newPointY = Big(roofLine.y1).minus(moveDist).toNumber()
const pDist = Big(wallLine.y1).minus(roofLine.y1).abs().toNumber()
const pLineX = Big(roofLine.x2).minus(0).toNumber()
@ -1655,8 +1828,14 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'bottom_in_end' })
if (Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
getAddLine({ x: pLineX, y: newPointY }, { x: sPoint.x, y: sPoint.y }, 'pink')
// Validate: newPointY should not cross over pLineY (adjacent line)
if (newPointY < pLineY) {
console.warn('⚠️ [BOTTOM_IN_END] Line crossing detected! newPointY:', newPointY, 'is less than pLineY:', pLineY, '| Clamping to prevent overlap')
newPointY = pLineY
}else {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
getAddLine({ x: pLineX, y: newPointY }, { x: sPoint.x, y: sPoint.y }, 'pink')
}
}
//getAddLine({ x: roofLine.x1, y: roofLine.y1 }, { x: roofLine.x1, y: newPointY }, 'orange')
getAddLine(newPStart, newPEnd, 'red')
@ -1666,10 +1845,10 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
console.log('isStartEnd:::::', isStartEnd)
const moveDistY1 = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const moveDistX1 = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const moveDistX2 = Big(wallLine.x2).minus(wallBaseLine.x2).abs().toNumber()
const moveDistY2 = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
const moveDistY1 = Big(roofLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const moveDistX1 = Big(roofLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const moveDistX2 = Big(roofLine.x2).minus(wallBaseLine.x2).abs().toNumber()
const moveDistY2 = Big(roofLine.y2).minus(wallBaseLine.y2).abs().toNumber()
const sPoint = { x: wallBaseLine.x1, y: wallBaseLine.y1 }
const ePoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }