내부선 완료

This commit is contained in:
yscha 2025-12-05 00:46:07 +09:00
parent 3cbfbbd0b3
commit c8ee66ca3a

View File

@ -761,13 +761,19 @@ if((roof.moveUpDown??0 > 0) ) {
const movedLines = []
sortedWallLines.forEach((wallLine, index) => {
wallLines.forEach((wallLine, index) => {
const roofLine = sortedRoofLines[index];
const currentRoofLine = sortedCurrentRoofLines[index];
const moveLine = sortedWallBaseLines[index]
const wallBaseLine = sortedWallBaseLines[index]
// const roofLine = sortedRoofLines[index];
// const currentRoofLine = sortedCurrentRoofLines[index];
// const moveLine = sortedWallBaseLines[index]
// const wallBaseLine = sortedWallBaseLines[index]
const roofLine = roofLines[index];
const currentRoofLine = currentRoofLines[index];
const moveLine = wall.baseLines[index]
const wallBaseLine = wall.baseLines[index]
//roofline 외곽선 설정
@ -859,7 +865,11 @@ if((roof.moveUpDown??0 > 0) ) {
const mLine = getSelectLinePosition(wall, wallBaseLine)
if (getOrientation(roofLine) === 'vertical') {
if (['left', 'right'].includes(mLine.position)) {
if(wallLine.x1 === wallBaseLine.x1) {
return false
}
const positionType =
(mLine.position === 'left' && wallLine.x1 < wallBaseLine.x1) ||
(mLine.position === 'right' && wallLine.x1 > wallBaseLine.x1)
@ -871,18 +881,31 @@ if((roof.moveUpDown??0 > 0) ) {
case 'left_in':
isIn = true
if (isStartEnd.start ) {
const moveDist = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
sPoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
newPEnd.y = wallBaseLine.y2;
newPStart.x = wallBaseLine.x2
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
findPoints.push({ x: sPoint.x, y: sPoint.y });
const newPointX = Big(roofLine.x1).plus(moveDist).toNumber()
getAddLine({ x: roofLine.x1, y: roofLine.y1 }, { x: newPointX, y: roofLine.y1 }, 'orange')
newPEnd.y = roofLine.y2;
newPEnd.x = roofLine.x2;
}else if(isStartEnd.end) {
const moveDist = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
ePoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
newPStart.y = wallBaseLine.y1
findPoints.push({ x: ePoint.x, y: ePoint.y });
const newPointX = Big(roofLine.x1).plus(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)?roofLines.length:index
const pLineX = roofLines[idx-1].x1
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: ePoint.x, y: ePoint.y }, 'blue')
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')
}
}
if(isStartEnd.end) {
newPStart.y = roofLine.y1;
newPStart.x = roofLine.x1;
@ -892,23 +915,20 @@ if((roof.moveUpDown??0 > 0) ) {
findPoints.push({ x: ePoint.x, y: ePoint.y });
const newPointX = Big(roofLine.x1).plus(moveDist).toNumber()
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
let idx = (roofLine.length < index + 1)?0:index
const pLineX = roofLines[idx+1].x2
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: ePoint.x, y: ePoint.y }, 'blue')
getAddLine({ x: roofLine.x1, y: roofLine.y1 }, { x: newPointX, y: roofLine.y1 }, 'orange')
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
getAddLine({ x: roofLine.x1, y: pLineY }, { x: newPointX, y: pLineY }, 'green')
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')
}
break;
case 'left_out':
if(isStartEnd.start){
@ -929,9 +949,59 @@ if((roof.moveUpDown??0 > 0) ) {
}
break;
case 'right_in':
newPEnd.y = wallBaseLine.y2;
getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
if (isStartEnd.start ) {
newPEnd.y = roofLine.y2;
newPEnd.x = roofLine.x2;
const moveDist = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
ePoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
newPStart.y = wallBaseLine.y1
findPoints.push({ x: ePoint.x, y: ePoint.y });
const 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)?roofLines.length:index
const pLineX = roofLines[idx-1].x1
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: ePoint.x, y: ePoint.y }, 'blue')
//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')
}
}
if(isStartEnd.end) {
newPStart.y = roofLine.y1;
newPStart.x = roofLine.x1;
const moveDist = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber()
ePoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
newPEnd.y = wallBaseLine.y2
findPoints.push({ x: ePoint.x, y: ePoint.y });
const 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 = (roofLine.length < index + 1)?0:index
const pLineX = roofLines[idx+1].x2
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: ePoint.x, y: ePoint.y }, 'blue')
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')
}
getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: newPointX, y: roofLine.y2 }, 'orange')
}
break;
case 'right_out':
const moveX1 = Math.abs(wallBaseLine.x2 - wallLine.x2)
@ -951,62 +1021,12 @@ if((roof.moveUpDown??0 > 0) ) {
}
//왼쪽 부터 roofLine, wallBaseLine
if (newPEnd.y <= wallBaseLine.y2 && wallBaseLine.y2 <= newPStart.y && newPStart.y <= wallBaseLine.y1) { //top right
// newPStart.y = wallBaseLine.y1;
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
// findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
} else if (wallBaseLine.y2 <= newPEnd.y && newPEnd.y <= wallBaseLine.y1 && wallBaseLine.y1 <= newPStart.y) { //bottom right
// newPEnd.y = wallBaseLine.y2;
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
// findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
} else if (newPStart.y <= wallBaseLine.y1 && wallBaseLine.y1 <= newPEnd.y && newPEnd.y <= wallBaseLine.y2) { //in top left / out top left
// if(isIn) {
// newPEnd.y = wallBaseLine.y2;
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
// findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
// }else if(isOut){
// const moveX = Math.abs(wallBaseLine.x1 - wallLine.x1)
// const aStartY = Math.abs(newPEnd.y + moveX)
// const bStartY = Math.abs(wallLine.y2 + moveX)
// //newPStart.x += moveX
// //wallLine.x1 += moveX
// findPoints.push({ x: newPEnd.x, y: aStartY});
// const inLine = findLineContainingPoint(innerLines, { x: newPEnd.x, y: aStartY})
// // console.log("startLines:::::::", inLine);
// getAddLine({ x: wallLine.x1, y: roofLine.y2 }, {x: wallLine.x1 , y: bStartY})
// getAddLine({ x: wallLine.x2, y: bStartY }, { x: inLine.x2, y: inLine.y2}, 'pink' )
// const eLineY = Math.abs( bStartY - wallLine.y2)
// newPStart.y += eLineY
// newPEnd.y = aStartY
// }
} else if (wallBaseLine.y1 <= newPStart.y && newPStart.y <= wallBaseLine.y2 && wallBaseLine.y2 <= newPEnd.y) { //bottom left
// newPStart.y = wallBaseLine.y1;
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
// findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
} else if (wallBaseLine.y2 <= newPEnd.y && newPEnd.y <= newPStart.y && newPStart.y <= wallBaseLine.y1) { // 위가운데
// newPEnd.y = wallBaseLine.y2;
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
// newPStart.y = wallBaseLine.y1;
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
} else if (wallBaseLine.y1 <= newPStart.y && newPStart.y <= newPEnd.y && newPEnd.y <= wallBaseLine.y2) {
// 아래가운데
// newPEnd.y = wallBaseLine.y1;
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
// newPStart.y = wallBaseLine.y2;
// getAddLine({ x: newPStart.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
}
} else if (getOrientation(roofLine) === 'horizontal') { //red
if (['top', 'bottom'].includes(mLine.position)) {
if(wallLine.y1 === wallBaseLine.y1) {
return false
}
const positionType =
(mLine.position === 'top' && wallLine.y1 < wallBaseLine.y1) ||
(mLine.position === 'bottom' && wallLine.y1 > wallBaseLine.y1)
@ -1033,23 +1053,38 @@ if((roof.moveUpDown??0 > 0) ) {
const pDist = Big(wallLine.y2).minus(roofLine.y2).abs().toNumber()
const pLineX = Big(roofLine.x1).minus(0).abs().toNumber()
let idx = (0 > index - 1)?roofLines.length:index
const pLineY = roofLines[idx-1].y1
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
findPoints.push({ x: sPoint.x, y: sPoint.y });
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
getAddLine({ x: pLineX, y: roofLine.y2 }, { x: pLineX, y: newPointY }, 'green')
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')
}
if(isStartEnd.end){
ePoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
const moveDist = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
sPoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
newPEnd.x = wallBaseLine.x2;
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: ePoint.x, y: ePoint.y })
findPoints.push({ x: ePoint.x, y: ePoint.y });
const newPointY = Big(roofLine.y1).plus(moveDist).toNumber()
const pDist = Big(wallLine.y1).minus(roofLine.y1).abs().toNumber()
const pLineX = Big(roofLine.x2).minus(0).abs().toNumber()
let idx = (roofLine.length < index + 1)?0:index
const pLineY = roofLines[idx+1].y2
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
findPoints.push({ x: sPoint.x, y: sPoint.y });
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')
}
//getAddLine({ x: roofLine.x1, y: roofLine.y1 }, { x: roofLine.x1, y: newPointY }, 'orange')
}
break;
@ -1078,20 +1113,44 @@ if((roof.moveUpDown??0 > 0) ) {
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
sPoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
newPStart.x = wallBaseLine.x1;
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: sPoint.x, y: sPoint.y })
const newPointY = Big(roofLine.y2).minus(moveDist).toNumber()
const pDist = Big(wallLine.y2).minus(roofLine.y2).abs().toNumber()
const pLineX = Big(roofLine.x1).minus(0).abs().toNumber()
let idx = (0 > index - 1)?roofLines.length:index
const pLineY = roofLines[idx-1].y1
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
findPoints.push({ x: sPoint.x, y: sPoint.y });
const newPointY = Big(roofLine.y2).minus(moveDist).abs().toNumber()
//getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: roofLine.x2, y: newPointY }, 'orange')
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')
}
getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: roofLine.x2, y: newPointY }, 'orange')
}
if(isStartEnd.end){
const moveDist = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
sPoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
newPStart.x = wallBaseLine.x1;
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: sPoint.x, y: sPoint.y })
sPoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
newPEnd.x = wallBaseLine.x2;
const newPointY = Big(roofLine.y1).minus(moveDist).toNumber()
const pDist = Big(wallLine.y1).minus(roofLine.y1).abs().toNumber()
const pLineX = Big(roofLine.x2).minus(0).abs().toNumber()
let idx = (roofLine.length < index + 1)?0:index
const pLineY = roofLines[idx+1].y2
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
findPoints.push({ x: sPoint.x, y: sPoint.y });
const newPointY = Big(roofLine.y1).minus(moveDist).abs().toNumber()
//getAddLine({ x: roofLine.x1, y: roofLine.y1 }, { x: roofLine.x1, y: newPointY }, 'orange')
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')
}
getAddLine({ x: roofLine.x1, y: roofLine.y1 }, { x: roofLine.x1, y: newPointY }, 'orange')
}