v0.1
This commit is contained in:
parent
c6c5fabbf2
commit
ebfc7da6a3
@ -875,208 +875,249 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
(mLine.position === 'right' && wallLine.x1 > wallBaseLine.x1)
|
||||
? 'in' : 'out';
|
||||
const condition = `${mLine.position}_${positionType}`;
|
||||
let isStartEnd = findInteriorPoint(wallBaseLine, sortedWallBaseLines)
|
||||
let isStartEnd = findInteriorPoint(wallBaseLine, wall.baseLines)
|
||||
let sPoint, ePoint;
|
||||
switch (condition) {
|
||||
case 'left_in':
|
||||
isIn = true
|
||||
if(condition === 'left_in') {
|
||||
isIn = true
|
||||
|
||||
if (isStartEnd.start ) {
|
||||
newPEnd.y = roofLine.y2;
|
||||
newPEnd.x = roofLine.x2;
|
||||
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
|
||||
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
|
||||
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')
|
||||
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(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;
|
||||
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
|
||||
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).plus(moveDist).toNumber()
|
||||
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
||||
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
|
||||
let idx = (roofLines.length < index + 1)?0:index
|
||||
const pLineX = roofLines[idx+1].x2
|
||||
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 = (roofLines.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')
|
||||
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')
|
||||
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')
|
||||
}
|
||||
break;
|
||||
case 'left_out':
|
||||
if(isStartEnd.start){
|
||||
//getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: newPointX, y: roofLine.y2 }, 'orange')
|
||||
}
|
||||
|
||||
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
|
||||
const aStartY = Big(roofLine.y1).minus(moveDist).abs().toNumber()
|
||||
const bStartY = Big(wallLine.y1).minus(moveDist).abs().toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x2 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineY = Big(bStartY).minus(wallLine.y1).abs().toNumber()
|
||||
newPEnd.y = aStartY
|
||||
newPStart.y = Big(roofLine.y2).minus(eLineY).toNumber()
|
||||
let idx = (0 >= index - 1)?roofLines.length:index
|
||||
const newLine = roofLines[idx-1];
|
||||
}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()
|
||||
const bStartY = Big(wallLine.y1).minus(moveDist).abs().toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x2 })
|
||||
|
||||
const eLineY = Big(bStartY).minus(wallLine.y1).abs().toNumber()
|
||||
newPEnd.y = aStartY
|
||||
newPStart.y = Big(roofLine.y2).minus(eLineY).toNumber()
|
||||
let idx = (0 >= index - 1)?roofLines.length:index
|
||||
const newLine = roofLines[idx-1];
|
||||
|
||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||
if(inLine){
|
||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||
}
|
||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: roofLine.y1, x: wallLine.x1 }, 'magenta')
|
||||
getAddLine({ y: newLine.y1, x: newLine.x1 }, { y: newLine.y2, x: wallLine.x2 }, 'Gray')
|
||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: roofLine.y1, x: wallLine.x1 }, 'magenta')
|
||||
getAddLine({ y: newLine.y1, x: newLine.x1 }, { y: newLine.y2, x: wallLine.x2 }, 'Gray')
|
||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
||||
}else{
|
||||
const cLineY = Big(wallBaseLine.y1).minus(wallLine.y1).abs().toNumber()
|
||||
newPEnd.y = Big(newPEnd.y).minus(cLineY).toNumber();
|
||||
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
||||
if(inLine){
|
||||
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||
}
|
||||
if(Math.abs(newPEnd.y - roofLine.y1) > 0.1) {
|
||||
//newPEnd.y = roofLine.y1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isStartEnd.end){
|
||||
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()
|
||||
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x1 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineY = Big(bStartY).minus(wallLine.y2).abs().toNumber()
|
||||
newPEnd.y = aStartY
|
||||
newPStart.y = Big(roofLine.y1).plus(eLineY).toNumber()
|
||||
let idx = (roofLines.length < index + 1)?0:index
|
||||
const newLine = roofLines[idx+1];
|
||||
|
||||
if(isStartEnd.end){
|
||||
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()
|
||||
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x1 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineY = Big(bStartY).minus(wallLine.y2).abs().toNumber()
|
||||
newPEnd.y = aStartY
|
||||
newPStart.y = Big(roofLine.y1).plus(eLineY).toNumber()
|
||||
let idx = (roofLines.length < index + 1)?0:index
|
||||
const newLine = roofLines[idx+1];
|
||||
|
||||
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
||||
if(inLine){
|
||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||
}
|
||||
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: roofLine.y2, x: wallLine.x2 }, 'magenta')
|
||||
getAddLine({ y: newLine.y2, x: newLine.x2 }, { y: newLine.y1, x: wallLine.x1 }, 'Gray')
|
||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case 'right_in':
|
||||
|
||||
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 = (roofLines.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':
|
||||
|
||||
|
||||
if (isStartEnd.start ) {
|
||||
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
|
||||
const aStartY = Big(roofLine.y1).plus(moveDist).toNumber()
|
||||
const bStartY = Big(wallLine.y1).plus(moveDist).toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x2 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineY = Big(bStartY).minus(wallLine.y1).abs().toNumber()
|
||||
newPEnd.y = aStartY
|
||||
newPStart.y = Big(roofLine.y2).plus(eLineY).toNumber()
|
||||
let idx = (0 >= index - 1)?roofLines.length:index
|
||||
const newLine = roofLines[idx-1];
|
||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: roofLine.y2, x: wallLine.x2 }, 'magenta')
|
||||
getAddLine({ y: newLine.y2, x: newLine.x2 }, { y: newLine.y1, x: wallLine.x1 }, 'Gray')
|
||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
||||
}else{
|
||||
const cLineY = Big(wallBaseLine.y2).minus(wallLine.y2).abs().toNumber()
|
||||
newPEnd.y = Big(newPEnd.y).plus(cLineY).toNumber();
|
||||
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
||||
if(inLine){
|
||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||
}
|
||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: roofLine.y1, x: wallLine.x1 }, 'magenta')
|
||||
getAddLine({ y: newLine.y1, x: newLine.x1 }, { y: newLine.y2, x: wallLine.x2 }, 'Gray')
|
||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
||||
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(isStartEnd.end){
|
||||
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
|
||||
const aStartY = Big(roofLine.y2).minus(moveDist).abs().toNumber()
|
||||
const bStartY = Big(wallLine.y2).minus(moveDist).abs().toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x1 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineY = Big(bStartY).minus(wallLine.y2).abs().toNumber()
|
||||
newPEnd.y = aStartY
|
||||
newPStart.y = Big(roofLine.y1).minus(eLineY).toNumber()
|
||||
let idx = (roofLines.length < index + 1)?0:index
|
||||
const newLine = roofLines[idx+1];
|
||||
if(inLine){
|
||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||
}
|
||||
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: roofLine.y2, x: wallLine.x2 }, 'magenta')
|
||||
getAddLine({ y: newLine.y2, x: newLine.x2 }, { y: newLine.y1, x: wallLine.x1 }, 'Gray')
|
||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else if(condition === 'right_in') {
|
||||
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 = (roofLines.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')
|
||||
}
|
||||
|
||||
}else if(condition === 'right_out') {
|
||||
console.log("right_out::::isStartEnd:::::", isStartEnd);
|
||||
if (isStartEnd.start ) { //x1 inside
|
||||
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
|
||||
const aStartY = Big(roofLine.y1).plus(moveDist).toNumber()
|
||||
const bStartY = Big(wallLine.y1).plus(moveDist).toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x2 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineY = Big(bStartY).minus(wallLine.y1).abs().toNumber()
|
||||
newPEnd.y = aStartY
|
||||
newPStart.y = Big(roofLine.y2).plus(eLineY).toNumber()
|
||||
let idx = (0 >= index - 1)?roofLines.length:index
|
||||
const newLine = roofLines[idx-1];
|
||||
|
||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||
if(inLine){
|
||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||
}
|
||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: roofLine.y1, x: wallLine.x1 }, 'magenta')
|
||||
getAddLine({ y: newLine.y1, x: newLine.x1 }, { y: newLine.y2, x: wallLine.x2 }, 'Gray')
|
||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
||||
}else{
|
||||
const cLineY = Big(wallBaseLine.y1).minus(wallLine.y1).abs().toNumber()
|
||||
newPEnd.y = Big(newPEnd.y).plus(cLineY).toNumber();
|
||||
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
||||
if(inLine){
|
||||
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(isStartEnd.end){
|
||||
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
|
||||
const aStartY = Big(roofLine.y2).minus(moveDist).abs().toNumber()
|
||||
const bStartY = Big(wallLine.y2).minus(moveDist).abs().toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x1 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineY = Big(bStartY).minus(wallLine.y2).abs().toNumber()
|
||||
newPEnd.y = aStartY
|
||||
newPStart.y = Big(roofLine.y1).minus(eLineY).toNumber()
|
||||
let idx = (roofLines.length < index + 1)?0:index
|
||||
const newLine = roofLines[idx+1];
|
||||
if(inLine){
|
||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||
}
|
||||
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: roofLine.y2, x: wallLine.x2 }, 'magenta')
|
||||
getAddLine({ y: newLine.y2, x: newLine.x2 }, { y: newLine.y1, x: wallLine.x1 }, 'Gray')
|
||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
||||
}else{
|
||||
const cLineY = Big(wallBaseLine.y2).minus(wallLine.y2).abs().toNumber()
|
||||
newPEnd.y = Big(newPEnd.y).minus(cLineY).toNumber();
|
||||
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
||||
if(inLine){
|
||||
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// switch (condition) {
|
||||
// case 'left_in':
|
||||
// break;
|
||||
// case 'left_out':
|
||||
// break;
|
||||
// case 'right_in':
|
||||
// break;
|
||||
// case 'right_out':
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@ -1092,197 +1133,235 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
? 'in' : 'out';
|
||||
|
||||
const condition = `${mLine.position}_${positionType}`;
|
||||
let isStartEnd = findInteriorPoint(wallBaseLine, sortedWallBaseLines)
|
||||
let isStartEnd = findInteriorPoint(wallBaseLine, wall.baseLines)
|
||||
|
||||
let sPoint, ePoint;
|
||||
|
||||
switch (condition) {
|
||||
case 'top_in':
|
||||
|
||||
console.log("findInteriorPoint result:::::::", isStartEnd);
|
||||
if(condition === 'top_in') {
|
||||
if (isStartEnd.start ) {
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
sPoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
||||
newPStart.x = wallBaseLine.x1;
|
||||
|
||||
|
||||
if (isStartEnd.start ) {
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
sPoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
||||
newPStart.x = wallBaseLine.x1;
|
||||
const newPointY = Big(roofLine.y2).plus(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).plus(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 });
|
||||
|
||||
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(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.x2, y: wallBaseLine.y2 }
|
||||
newPEnd.x = wallBaseLine.x2
|
||||
if(isStartEnd.end){
|
||||
const moveDist = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
|
||||
sPoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
|
||||
newPEnd.x = wallBaseLine.x2
|
||||
|
||||
const newPointY = Big(roofLine.y1).plus(moveDist).toNumber()
|
||||
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 = roofLines.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 pDist = Big(wallLine.y1).minus(roofLine.y1).abs().toNumber()
|
||||
const pLineX = Big(roofLine.x2).minus(0).abs().toNumber()
|
||||
let idx = roofLines.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')
|
||||
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;
|
||||
case 'top_out':
|
||||
//console.log("findInteriorPoint result:::::::", isStartEnd);
|
||||
if (isStartEnd.start ) {
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
const aStartX = Big(roofLine.x1).plus(moveDist).toNumber()
|
||||
const bStartX = Big(wallLine.x1).plus(moveDist).toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineX = Big(bStartX).minus(wallLine.x1).abs().toNumber()
|
||||
newPEnd.x = Big(newPEnd.x).plus(eLineX).toNumber()
|
||||
newPStart.x = aStartX
|
||||
let idx = (0 > index - 1)?roofLines.length:index
|
||||
const newLine = roofLines[idx-1];
|
||||
}else if(condition === 'top_out') {
|
||||
console.log("top_out isStartEnd:::::::", isStartEnd);
|
||||
if (isStartEnd.start ) {
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
const aStartX = Big(roofLine.x1).plus(moveDist).toNumber()
|
||||
const bStartX = Big(wallLine.x1).plus(moveDist).toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
|
||||
|
||||
const eLineX = Big(bStartX).minus(wallLine.x1).abs().toNumber()
|
||||
newPEnd.x = Big(newPEnd.x).plus(eLineX).toNumber()
|
||||
newPStart.x = aStartX
|
||||
let idx = (0 > index - 1)?roofLines.length:index
|
||||
const newLine = roofLines[idx-1];
|
||||
|
||||
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
||||
if(inLine){
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||
}
|
||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 }, 'magenta')
|
||||
getAddLine({ x: newLine.x1, y: newLine.y1 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 }, 'magenta')
|
||||
getAddLine({ x: newLine.x1, y: newLine.y1 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||
}else{
|
||||
const cLineX = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
|
||||
newPStart.x = Big(newPStart.x).plus(cLineX).toNumber();
|
||||
const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
|
||||
if(inLine){
|
||||
getAddLine({ y: newPStart.y, x: newPStart.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||
}
|
||||
|
||||
}
|
||||
if(isStartEnd.end){
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
const aStartX = Big(roofLine.x2).minus(moveDist).abs().toNumber()
|
||||
const bStartX = Big(wallLine.x2).minus(moveDist).abs().toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineX = Big(bStartX).minus(wallLine.x2).abs().toNumber()
|
||||
newPStart.x = Big(newPStart.x).minus(eLineX).abs().toNumber()
|
||||
newPEnd.x = aStartX
|
||||
let idx = (roofLines.length < index + 1)?0:index
|
||||
const newLine = roofLines[idx+1];
|
||||
}
|
||||
if(isStartEnd.end){
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
const aStartX = Big(roofLine.x2).minus(moveDist).abs().toNumber()
|
||||
const bStartX = Big(wallLine.x2).minus(moveDist).abs().toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineX = Big(bStartX).minus(wallLine.x2).abs().toNumber()
|
||||
newPStart.x = Big(newPStart.x).minus(eLineX).abs().toNumber()
|
||||
newPEnd.x = aStartX
|
||||
let idx = (roofLines.length < index + 1)?0:index
|
||||
const newLine = roofLines[idx+1];
|
||||
|
||||
if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
||||
if(inLine){
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||
}
|
||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x2, y: wallLine.y2 }, 'magenta')
|
||||
getAddLine({ x: newLine.x2, y: newLine.y2 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x2, y: wallLine.y2 }, 'magenta')
|
||||
getAddLine({ x: newLine.x2, y: newLine.y2 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||
}else{
|
||||
const cLineX = Big(wallLine.x2).minus(wallBaseLine.x2).abs().toNumber()
|
||||
newPEnd.x = Big(newPEnd.x).minus(cLineX).toNumber();
|
||||
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
||||
if(inLine){
|
||||
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'bottom_in':
|
||||
|
||||
if (isStartEnd.start ) {
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
sPoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
||||
newPStart.x = wallBaseLine.x1;
|
||||
|
||||
|
||||
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 });
|
||||
|
||||
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.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 = (roofLines.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')
|
||||
|
||||
}
|
||||
}
|
||||
}else if(condition === 'bottom_in') {
|
||||
if (isStartEnd.start ) {
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
sPoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
||||
newPStart.x = wallBaseLine.x1;
|
||||
|
||||
break;
|
||||
case 'bottom_out':
|
||||
|
||||
if (isStartEnd.start ) {
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
const aStartX = Big(roofLine.x1).minus(moveDist).abs().toNumber()
|
||||
const bStartX = Big(wallLine.x1).minus(moveDist).abs().toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: roofLine.y1 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineX = Big(bStartX).minus(wallLine.x1).abs().toNumber()
|
||||
newPEnd.x = Big(roofLine.x2).minus(eLineX).toNumber()
|
||||
newPStart.x = aStartX
|
||||
let idx = (0 > index - 1)?roofLines.length:index
|
||||
const newLine = roofLines[idx-1];
|
||||
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 });
|
||||
|
||||
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.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 = (roofLines.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')
|
||||
|
||||
}
|
||||
}else if(condition === 'bottom_out') {
|
||||
console.log("bottom_out isStartEnd:::::::", isStartEnd);
|
||||
if (isStartEnd.start ) {
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
const aStartX = Big(roofLine.x1).minus(moveDist).abs().toNumber()
|
||||
const bStartX = Big(wallLine.x1).minus(moveDist).abs().toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: roofLine.y1 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineX = Big(bStartX).minus(wallLine.x1).abs().toNumber()
|
||||
newPEnd.x = Big(roofLine.x2).minus(eLineX).toNumber()
|
||||
newPStart.x = aStartX
|
||||
let idx = (0 > index - 1)?roofLines.length:index
|
||||
const newLine = roofLines[idx-1];
|
||||
|
||||
|
||||
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
||||
if(inLine){
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||
}
|
||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 }, 'magenta')
|
||||
getAddLine({ x: newLine.x1, y: newLine.y1 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 }, 'magenta')
|
||||
getAddLine({ x: newLine.x1, y: newLine.y1 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||
}else{
|
||||
const cLineX = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
|
||||
newPStart.x = Big(newPStart.x).minus(cLineX).toNumber();
|
||||
const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
|
||||
if(inLine){
|
||||
getAddLine({ y: newPStart.y, x: newPStart.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||
}
|
||||
}
|
||||
|
||||
if(isStartEnd.end){
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
const aStartX = Big(roofLine.x2).plus(moveDist).toNumber()
|
||||
const bStartX = Big(wallLine.x2).plus(moveDist).toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: roofLine.y1 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineX = Big(bStartX).minus(wallLine.x2).abs().toNumber()
|
||||
newPEnd.x = aStartX
|
||||
newPStart.x = Big(roofLine.x1).plus(eLineX).toNumber()
|
||||
let idx = (0 > index - 1)?roofLines.length:index
|
||||
const newLine = roofLines[idx-1];
|
||||
}
|
||||
}
|
||||
|
||||
if(isStartEnd.end){
|
||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||
const aStartX = Big(roofLine.x2).plus(moveDist).toNumber()
|
||||
const bStartX = Big(wallLine.x2).plus(moveDist).toNumber()
|
||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: roofLine.y1 })
|
||||
console.log("startLines:::::::", inLine);
|
||||
const eLineX = Big(bStartX).minus(wallLine.x2).abs().toNumber()
|
||||
newPEnd.x = aStartX
|
||||
newPStart.x = Big(roofLine.x1).plus(eLineX).toNumber()
|
||||
let idx = (0 > index - 1)?roofLines.length:index
|
||||
const newLine = roofLines[idx-1];
|
||||
|
||||
if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
||||
if(inLine){
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||
}
|
||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x2, y: wallLine.y2 }, 'magenta')
|
||||
getAddLine({ x: newLine.x2, y: newLine.y2 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x2, y: wallLine.y2 }, 'magenta')
|
||||
getAddLine({ x: newLine.x2, y: newLine.y2 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||
}else{
|
||||
const cLineX = Big(wallBaseLine.y2).minus(wallLine.y2).abs().toNumber()
|
||||
newPEnd.x = Big(newPEnd.x).plus(cLineX).toNumber();
|
||||
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
||||
if(inLine){
|
||||
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// switch (condition) {
|
||||
// case 'top_in':
|
||||
// //console.log("findInteriorPoint result:::::::", isStartEnd);
|
||||
// break;
|
||||
// case 'top_out':
|
||||
// //console.log("findInteriorPoint result:::::::", isStartEnd);
|
||||
// break;
|
||||
// case 'bottom_in':
|
||||
// break;
|
||||
// case 'bottom_out':
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
}
|
||||
getAddLine(newPStart, newPEnd, 'red')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user