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)
|
(mLine.position === 'right' && wallLine.x1 > wallBaseLine.x1)
|
||||||
? 'in' : 'out';
|
? 'in' : 'out';
|
||||||
const condition = `${mLine.position}_${positionType}`;
|
const condition = `${mLine.position}_${positionType}`;
|
||||||
let isStartEnd = findInteriorPoint(wallBaseLine, sortedWallBaseLines)
|
let isStartEnd = findInteriorPoint(wallBaseLine, wall.baseLines)
|
||||||
let sPoint, ePoint;
|
let sPoint, ePoint;
|
||||||
switch (condition) {
|
if(condition === 'left_in') {
|
||||||
case 'left_in':
|
isIn = true
|
||||||
isIn = true
|
|
||||||
|
|
||||||
if (isStartEnd.start ) {
|
if (isStartEnd.start ) {
|
||||||
newPEnd.y = roofLine.y2;
|
newPEnd.y = roofLine.y2;
|
||||||
newPEnd.x = roofLine.x2;
|
newPEnd.x = roofLine.x2;
|
||||||
|
|
||||||
const moveDist = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
|
const moveDist = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
|
||||||
ePoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
ePoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
||||||
newPStart.y = wallBaseLine.y1
|
newPStart.y = wallBaseLine.y1
|
||||||
|
|
||||||
findPoints.push({ x: ePoint.x, y: ePoint.y });
|
findPoints.push({ x: ePoint.x, y: ePoint.y });
|
||||||
const newPointX = Big(roofLine.x1).plus(moveDist).abs().toNumber()
|
const newPointX = Big(roofLine.x1).plus(moveDist).abs().toNumber()
|
||||||
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
||||||
const pLineY = Big(roofLine.y1).minus(0).abs().toNumber()
|
const pLineY = Big(roofLine.y1).minus(0).abs().toNumber()
|
||||||
let idx = (0 > index - 1)?roofLines.length:index
|
let idx = (0 > index - 1)?roofLines.length:index
|
||||||
const pLineX = roofLines[idx-1].x1
|
const pLineX = roofLines[idx-1].x1
|
||||||
|
|
||||||
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: ePoint.x, y: ePoint.y }, 'blue')
|
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: roofLine.x2, y: roofLine.y2 }, { x: newPointX, y: roofLine.y2 }, 'orange')
|
||||||
|
|
||||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||||
getAddLine({ x: pLineX, 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: newPointX, y: pLineY }, { x: ePoint.x, y: ePoint.y }, 'pink')
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(isStartEnd.end) {
|
if(isStartEnd.end) {
|
||||||
newPStart.y = roofLine.y1;
|
newPStart.y = roofLine.y1;
|
||||||
newPStart.x = roofLine.x1;
|
newPStart.x = roofLine.x1;
|
||||||
|
|
||||||
const moveDist = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber()
|
const moveDist = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber()
|
||||||
ePoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
|
ePoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
|
||||||
newPEnd.y = wallBaseLine.y2
|
newPEnd.y = wallBaseLine.y2
|
||||||
|
|
||||||
findPoints.push({ x: ePoint.x, y: ePoint.y });
|
findPoints.push({ x: ePoint.x, y: ePoint.y });
|
||||||
const newPointX = Big(roofLine.x1).plus(moveDist).toNumber()
|
const newPointX = Big(roofLine.x1).plus(moveDist).toNumber()
|
||||||
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
||||||
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
|
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
|
||||||
let idx = (roofLines.length < index + 1)?0:index
|
let idx = (roofLines.length < index + 1)?0:index
|
||||||
const pLineX = roofLines[idx+1].x2
|
const pLineX = roofLines[idx+1].x2
|
||||||
|
|
||||||
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: ePoint.x, y: ePoint.y }, 'blue')
|
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: roofLine.x1, y: roofLine.y1 }, { x: newPointX, y: roofLine.y1 }, 'orange')
|
||||||
|
|
||||||
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
||||||
getAddLine({ x: pLineX, 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: newPointX, y: pLineY }, { x: ePoint.x, y: ePoint.y }, 'pink')
|
||||||
}
|
|
||||||
//getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: newPointX, y: roofLine.y2 }, 'orange')
|
|
||||||
}
|
}
|
||||||
break;
|
//getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: newPointX, y: roofLine.y2 }, 'orange')
|
||||||
case 'left_out':
|
}
|
||||||
if(isStartEnd.start){
|
|
||||||
|
|
||||||
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
|
}else if(condition === 'left_out') {
|
||||||
const aStartY = Big(roofLine.y1).minus(moveDist).abs().toNumber()
|
console.log("left_out::::isStartEnd:::::", isStartEnd);
|
||||||
const bStartY = Big(wallLine.y1).minus(moveDist).abs().toNumber()
|
if(isStartEnd.start){
|
||||||
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x2 })
|
|
||||||
console.log("startLines:::::::", inLine);
|
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
|
||||||
const eLineY = Big(bStartY).minus(wallLine.y1).abs().toNumber()
|
const aStartY = Big(roofLine.y1).minus(moveDist).abs().toNumber()
|
||||||
newPEnd.y = aStartY
|
const bStartY = Big(wallLine.y1).minus(moveDist).abs().toNumber()
|
||||||
newPStart.y = Big(roofLine.y2).minus(eLineY).toNumber()
|
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x2 })
|
||||||
let idx = (0 >= index - 1)?roofLines.length:index
|
|
||||||
const newLine = roofLines[idx-1];
|
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){
|
if(inLine){
|
||||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
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: 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')
|
||||||
getAddLine({ y: newLine.y1, x: newLine.x1 }, { y: newLine.y2, x: wallLine.x2 }, 'Gray')
|
findPoints.push({ y: aStartY, x: newPEnd.x });
|
||||||
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()
|
if(isStartEnd.end){
|
||||||
const aStartY = Big(roofLine.y2).plus(moveDist).toNumber()
|
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
|
||||||
const bStartY = Big(wallLine.y2).plus(moveDist).toNumber()
|
const aStartY = Big(roofLine.y2).plus(moveDist).toNumber()
|
||||||
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x1 })
|
const bStartY = Big(wallLine.y2).plus(moveDist).toNumber()
|
||||||
console.log("startLines:::::::", inLine);
|
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x1 })
|
||||||
const eLineY = Big(bStartY).minus(wallLine.y2).abs().toNumber()
|
console.log("startLines:::::::", inLine);
|
||||||
newPEnd.y = aStartY
|
const eLineY = Big(bStartY).minus(wallLine.y2).abs().toNumber()
|
||||||
newPStart.y = Big(roofLine.y1).plus(eLineY).toNumber()
|
newPEnd.y = aStartY
|
||||||
let idx = (roofLines.length < index + 1)?0:index
|
newPStart.y = Big(roofLine.y1).plus(eLineY).toNumber()
|
||||||
const newLine = roofLines[idx+1];
|
let idx = (roofLines.length < index + 1)?0:index
|
||||||
|
const newLine = roofLines[idx+1];
|
||||||
|
|
||||||
|
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
||||||
if(inLine){
|
if(inLine){
|
||||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
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: 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')
|
||||||
getAddLine({ y: newLine.y2, x: newLine.x2 }, { y: newLine.y1, x: wallLine.x1 }, 'Gray')
|
findPoints.push({ y: aStartY, x: newPEnd.x });
|
||||||
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 })
|
||||||
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];
|
|
||||||
if(inLine){
|
if(inLine){
|
||||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||||
}
|
|
||||||
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 });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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';
|
? 'in' : 'out';
|
||||||
|
|
||||||
const condition = `${mLine.position}_${positionType}`;
|
const condition = `${mLine.position}_${positionType}`;
|
||||||
let isStartEnd = findInteriorPoint(wallBaseLine, sortedWallBaseLines)
|
let isStartEnd = findInteriorPoint(wallBaseLine, wall.baseLines)
|
||||||
|
|
||||||
let sPoint, ePoint;
|
let sPoint, ePoint;
|
||||||
|
|
||||||
switch (condition) {
|
if(condition === 'top_in') {
|
||||||
case 'top_in':
|
if (isStartEnd.start ) {
|
||||||
|
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||||
console.log("findInteriorPoint result:::::::", isStartEnd);
|
sPoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
||||||
|
newPStart.x = wallBaseLine.x1;
|
||||||
|
|
||||||
|
|
||||||
if (isStartEnd.start ) {
|
const newPointY = Big(roofLine.y2).plus(moveDist).toNumber()
|
||||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
|
||||||
sPoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
|
||||||
newPStart.x = wallBaseLine.x1;
|
|
||||||
|
|
||||||
|
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()
|
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
||||||
|
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
|
||||||
const pDist = Big(wallLine.y2).minus(roofLine.y2).abs().toNumber()
|
getAddLine({ x: pLineX, y: newPointY }, { x: sPoint.x, y: sPoint.y }, 'pink')
|
||||||
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')
|
|
||||||
}
|
}
|
||||||
|
//getAddLine({ x: roofLine.x2, y: roofLine.y2 }, { x: roofLine.x2, y: newPointY }, 'orange')
|
||||||
|
}
|
||||||
|
|
||||||
if(isStartEnd.end){
|
if(isStartEnd.end){
|
||||||
const moveDist = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
|
const moveDist = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
|
||||||
sPoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
|
sPoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
|
||||||
newPEnd.x = wallBaseLine.x2
|
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 pDist = Big(wallLine.y1).minus(roofLine.y1).abs().toNumber()
|
||||||
const pLineX = Big(roofLine.x2).minus(0).abs().toNumber()
|
const pLineX = Big(roofLine.x2).minus(0).abs().toNumber()
|
||||||
let idx = roofLines.length < index + 1 ? 0 : index
|
let idx = roofLines.length < index + 1 ? 0 : index
|
||||||
const pLineY = roofLines[idx + 1].y2
|
const pLineY = roofLines[idx + 1].y2
|
||||||
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
|
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: pLineY }, { x: pLineX, y: newPointY }, 'green')
|
||||||
getAddLine({ x: pLineX, y: newPointY }, { x: sPoint.x, y: sPoint.y }, 'pink')
|
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({ x: roofLine.x1, y: roofLine.y1 }, { x: roofLine.x1, y: newPointY }, 'orange')
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
}else if(condition === 'top_out') {
|
||||||
case 'top_out':
|
console.log("top_out isStartEnd:::::::", isStartEnd);
|
||||||
//console.log("findInteriorPoint result:::::::", isStartEnd);
|
if (isStartEnd.start ) {
|
||||||
if (isStartEnd.start ) {
|
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||||
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
const aStartX = Big(roofLine.x1).plus(moveDist).toNumber()
|
||||||
const aStartX = Big(roofLine.x1).plus(moveDist).toNumber()
|
const bStartX = Big(wallLine.x1).plus(moveDist).toNumber()
|
||||||
const bStartX = Big(wallLine.x1).plus(moveDist).toNumber()
|
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
|
||||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
|
|
||||||
console.log("startLines:::::::", inLine);
|
const eLineX = Big(bStartX).minus(wallLine.x1).abs().toNumber()
|
||||||
const eLineX = Big(bStartX).minus(wallLine.x1).abs().toNumber()
|
newPEnd.x = Big(newPEnd.x).plus(eLineX).toNumber()
|
||||||
newPEnd.x = Big(newPEnd.x).plus(eLineX).toNumber()
|
newPStart.x = aStartX
|
||||||
newPStart.x = aStartX
|
let idx = (0 > index - 1)?roofLines.length:index
|
||||||
let idx = (0 > index - 1)?roofLines.length:index
|
const newLine = roofLines[idx-1];
|
||||||
const newLine = roofLines[idx-1];
|
|
||||||
|
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
||||||
if(inLine){
|
if(inLine){
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
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: 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')
|
||||||
getAddLine({ x: newLine.x1, y: newLine.y1 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||||
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()
|
if(isStartEnd.end){
|
||||||
const aStartX = Big(roofLine.x2).minus(moveDist).abs().toNumber()
|
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||||
const bStartX = Big(wallLine.x2).minus(moveDist).abs().toNumber()
|
const aStartX = Big(roofLine.x2).minus(moveDist).abs().toNumber()
|
||||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
|
const bStartX = Big(wallLine.x2).minus(moveDist).abs().toNumber()
|
||||||
console.log("startLines:::::::", inLine);
|
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
|
||||||
const eLineX = Big(bStartX).minus(wallLine.x2).abs().toNumber()
|
console.log("startLines:::::::", inLine);
|
||||||
newPStart.x = Big(newPStart.x).minus(eLineX).abs().toNumber()
|
const eLineX = Big(bStartX).minus(wallLine.x2).abs().toNumber()
|
||||||
newPEnd.x = aStartX
|
newPStart.x = Big(newPStart.x).minus(eLineX).abs().toNumber()
|
||||||
let idx = (roofLines.length < index + 1)?0:index
|
newPEnd.x = aStartX
|
||||||
const newLine = roofLines[idx+1];
|
let idx = (roofLines.length < index + 1)?0:index
|
||||||
|
const newLine = roofLines[idx+1];
|
||||||
|
|
||||||
|
if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
||||||
if(inLine){
|
if(inLine){
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
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: 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')
|
||||||
getAddLine({ x: newLine.x2, y: newLine.y2 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||||
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 newPointY = Big(roofLine.y2).minus(moveDist).toNumber()
|
||||||
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 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){
|
if(inLine){
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
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: 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')
|
||||||
getAddLine({ x: newLine.x1, y: newLine.y1 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||||
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()
|
if(isStartEnd.end){
|
||||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: roofLine.y1 })
|
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
|
||||||
console.log("startLines:::::::", inLine);
|
const aStartX = Big(roofLine.x2).plus(moveDist).toNumber()
|
||||||
const eLineX = Big(bStartX).minus(wallLine.x2).abs().toNumber()
|
const bStartX = Big(wallLine.x2).plus(moveDist).toNumber()
|
||||||
newPEnd.x = aStartX
|
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: roofLine.y1 })
|
||||||
newPStart.x = Big(roofLine.x1).plus(eLineX).toNumber()
|
console.log("startLines:::::::", inLine);
|
||||||
let idx = (0 > index - 1)?roofLines.length:index
|
const eLineX = Big(bStartX).minus(wallLine.x2).abs().toNumber()
|
||||||
const newLine = roofLines[idx-1];
|
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){
|
if(inLine){
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
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: 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')
|
||||||
getAddLine({ x: newLine.x2, y: newLine.y2 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||||
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')
|
getAddLine(newPStart, newPEnd, 'red')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user