[1177] 지붕면 작성 불량

This commit is contained in:
Jaeyoung Lee 2025-07-07 17:57:40 +09:00
parent 624815ba0d
commit b130d844c2

View File

@ -4927,20 +4927,41 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
prevEndPoint.y = Big(intersection.y)
}
}
const overlapLine = baseHipLines.find((line) => isPointOnLine(line, { x: prevEndPoint.x.toNumber(), y: prevEndPoint.y.toNumber() }))
const overlapLine = baseHipLines.find(
(line) =>
isPointOnLineNew({ x1: x1, y1: y1, x2: prevEndPoint.x.toNumber(), y2: prevEndPoint.y.toNumber() }, { x: line.x1, y: line.y1 }) ||
isPointOnLineNew({ x1: x1, y1: y1, x2: prevEndPoint.x.toNumber(), y2: prevEndPoint.y.toNumber() }, { x: line.x2, y: line.y2 }),
)
if (overlapLine) {
let size1, size2
if (
isPointOnLine({ x1: x1, y1: y1, x2: prevEndPoint.x.toNumber(), y2: prevEndPoint.y.toNumber() }, { x: overlapLine.x1, y: overlapLine.y1 })
isPointOnLineNew({ x1: x1, y1: y1, x2: prevEndPoint.x.toNumber(), y2: prevEndPoint.y.toNumber() }, { x: overlapLine.x1, y: overlapLine.y1 })
) {
prevEndPoint.x = Big(overlapLine.x1)
prevEndPoint.y = Big(overlapLine.y1)
size1 = Math.sqrt(Math.pow(x1 - overlapLine.x1, 2) + Math.pow(y1 - overlapLine.y1, 2))
}
if (
isPointOnLine({ x1: x1, y1: y1, x2: prevEndPoint.x.toNumber(), y2: prevEndPoint.y.toNumber() }, { x: overlapLine.x2, y: overlapLine.y2 })
isPointOnLineNew({ x1: x1, y1: y1, x2: prevEndPoint.x.toNumber(), y2: prevEndPoint.y.toNumber() }, { x: overlapLine.x2, y: overlapLine.y2 })
) {
prevEndPoint.x = Big(overlapLine.x2)
prevEndPoint.y = Big(overlapLine.y2)
size2 = Math.sqrt(Math.pow(x1 - overlapLine.x2, 2) + Math.pow(y1 - overlapLine.y2, 2))
}
if (size1 && size2) {
if (size1 < size2) {
prevEndPoint.x = Big(overlapLine.x1)
prevEndPoint.y = Big(overlapLine.y1)
} else {
prevEndPoint.x = Big(overlapLine.x2)
prevEndPoint.y = Big(overlapLine.y2)
}
} else {
if (size1) {
prevEndPoint.x = Big(overlapLine.x1)
prevEndPoint.y = Big(overlapLine.y1)
}
if (size2) {
prevEndPoint.x = Big(overlapLine.x2)
prevEndPoint.y = Big(overlapLine.y2)
}
}
}
const intersectRidgeLine = []
@ -5052,20 +5073,41 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
}
}
const overlapLine = baseHipLines.find((line) => isPointOnLine(line, { x: nextEndPoint.x.toNumber(), y: nextEndPoint.y.toNumber() }))
// const overlapLine = baseHipLines.find((line) => isPointOnLine(line, { x: nextEndPoint.x.toNumber(), y: nextEndPoint.y.toNumber() }))
const overlapLine = baseHipLines.find(
(line) =>
isPointOnLineNew({ x1: x2, y1: y2, x2: nextEndPoint.x.toNumber(), y2: nextEndPoint.y.toNumber() }, { x: line.x1, y: line.y1 }) ||
isPointOnLineNew({ x1: x2, y1: y2, x2: nextEndPoint.x.toNumber(), y2: nextEndPoint.y.toNumber() }, { x: line.x2, y: line.y2 }),
)
if (overlapLine) {
let size1, size2
if (
isPointOnLine({ x1: x2, y1: y2, x2: nextEndPoint.x.toNumber(), y2: nextEndPoint.y.toNumber() }, { x: overlapLine.x1, y: overlapLine.y1 })
isPointOnLineNew({ x1: x2, y1: y2, x2: nextEndPoint.x.toNumber(), y2: nextEndPoint.y.toNumber() }, { x: overlapLine.x1, y: overlapLine.y1 })
) {
nextEndPoint.x = Big(overlapLine.x1)
nextEndPoint.y = Big(overlapLine.y1)
size1 = Math.sqrt(Math.pow(x2 - overlapLine.x1, 2) + Math.pow(y2 - overlapLine.y1, 2))
}
if (
isPointOnLine({ x1: x2, y1: y2, x2: nextEndPoint.x.toNumber(), y2: nextEndPoint.y.toNumber() }, { x: overlapLine.x2, y: overlapLine.y2 })
isPointOnLineNew({ x1: x2, y1: y2, x2: nextEndPoint.x.toNumber(), y2: nextEndPoint.y.toNumber() }, { x: overlapLine.x2, y: overlapLine.y2 })
) {
nextEndPoint.x = Big(overlapLine.x2)
nextEndPoint.y = Big(overlapLine.y2)
size2 = Math.sqrt(Math.pow(x2 - overlapLine.x2, 2) + Math.pow(y2 - overlapLine.y2, 2))
}
if (size1 && size2) {
if (size1 < size2) {
nextEndPoint.x = Big(overlapLine.x1)
nextEndPoint.y = Big(overlapLine.y1)
} else {
nextEndPoint.x = Big(overlapLine.x2)
nextEndPoint.y = Big(overlapLine.y2)
}
} else {
if (size1) {
nextEndPoint.x = Big(overlapLine.x1)
nextEndPoint.y = Big(overlapLine.y1)
}
if (size2) {
nextEndPoint.x = Big(overlapLine.x2)
nextEndPoint.y = Big(overlapLine.y2)
}
}
}