diff --git a/src/util/skeleton-utils.js b/src/util/skeleton-utils.js index bce7dd16..412b40b4 100644 --- a/src/util/skeleton-utils.js +++ b/src/util/skeleton-utils.js @@ -1024,7 +1024,7 @@ if((roof.moveUpDown??0 > 0) ) { } else if (getOrientation(roofLine) === 'horizontal') { //red if (['top', 'bottom'].includes(mLine.position)) { - if(wallLine.y1 === wallBaseLine.y1) { + if(Math.abs(wallLine.y1 - wallBaseLine.y1) < 0.1) { return false } const positionType = @@ -1067,20 +1067,19 @@ if((roof.moveUpDown??0 > 0) ) { if(isStartEnd.end){ const moveDist = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber() - sPoint = {x: wallBaseLine.x2, y: wallBaseLine.y2}; - newPEnd.x = wallBaseLine.x2; - + sPoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 } + newPEnd.x = wallBaseLine.x2 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 + 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 }); + findPoints.push({ x: sPoint.x, y: sPoint.y }) - if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) { + 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') } @@ -1090,22 +1089,26 @@ if((roof.moveUpDown??0 > 0) ) { break; case 'top_out': console.log("findInteriorPoint result:::::::", isStartEnd); + if (isStartEnd.start ) { + const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber() + const dist = Math.abs(roofLine.y1 - wallLine.y1) + const aStartX = Big(newPStart.x).plus(moveDist).toNumber() + const bStartX = Big(wallLine.x1).plus(moveDist).toNumber() - const moveY = Math.abs(wallLine.y1 - wallBaseLine.y1) - const dist = Math.abs(roofLine.y1 - wallLine.y1) - const aStartX = Math.abs(newPStart.x + moveY) - const bStartX = Math.abs(wallLine.x1 + moveY) + //newPStart.x += moveX + //wallLine.x1 += moveX + findPoints.push({ x: aStartX, y: newPEnd.y }); + const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y }) + console.log("startLines:::::::", inLine); + getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 }, 'darkblue') + getAddLine({ x: bStartX, y: wallLine.y2 }, { x: inLine.x2, y: inLine.y2 }, 'pink') + const eLineX = Big(bStartX).minus(wallLine.x1).abs().toNumber() + newPEnd.x += eLineX + newPStart.x = aStartX + } + if(isStartEnd.end){ - //newPStart.x += moveX - //wallLine.x1 += moveX - findPoints.push({ x: aStartX, y: newPEnd.y }); - const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y }) - console.log("startLines:::::::", inLine); - getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 }) - getAddLine({ x: bStartX, y: wallLine.y2 }, { x: inLine.x2, y: inLine.y2 }, 'pink') - const eLineX = Math.abs(bStartX - wallLine.x1) - newPEnd.x += eLineX - newPStart.x = aStartX + } break; case 'bottom_in':