Merge pull request 'dev' (#136) from dev into dev-deploy
Reviewed-on: #136
This commit is contained in:
commit
be4c6ecf65
@ -5404,6 +5404,80 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
|||||||
.toNumber(),
|
.toNumber(),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const oppositeHipPoints = []
|
||||||
|
const ridgeEdge = { vertex1: { x: points[0], y: points[1] }, vertex2: { x: points[2], y: points[3] } }
|
||||||
|
if (prevLine.attributes.type === LINE_TYPE.WALLLINE.EAVES && beforePrevLine.line.attributes.type === LINE_TYPE.WALLLINE.EAVES) {
|
||||||
|
let hipVector = getHalfAngleVector(prevLine, beforePrevLine.line)
|
||||||
|
/** 이전 라인과의 사이 추녀마루의 각도를 확인한다, 각도가 지붕안쪽으로 향하지 않을때 반대로 처리한다.*/
|
||||||
|
const checkPoint = {
|
||||||
|
x: Big(prevLine.x1).plus(Big(hipVector.x).times(10)),
|
||||||
|
y: Big(prevLine.y1).plus(Big(hipVector.y).times(10)),
|
||||||
|
}
|
||||||
|
if (!checkWallPolygon.inPolygon(checkPoint)) {
|
||||||
|
hipVector = { x: -hipVector.x, y: -hipVector.y }
|
||||||
|
}
|
||||||
|
|
||||||
|
const hipEdge = {
|
||||||
|
vertex1: { x: prevLine.x1, y: prevLine.y1 },
|
||||||
|
vertex2: {
|
||||||
|
x: Big(prevLine.x1).plus(Big(hipVector.x).times(prevLine.attributes.planeSize)).toNumber(),
|
||||||
|
y: Big(prevLine.y1).plus(Big(hipVector.y).times(prevLine.attributes.planeSize)).toNumber(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const intersection = edgesIntersection(ridgeEdge, hipEdge)
|
||||||
|
if (intersection) {
|
||||||
|
const size = Big(points[0] - intersection.x)
|
||||||
|
.abs()
|
||||||
|
.pow(2)
|
||||||
|
.plus(
|
||||||
|
Big(points[1] - intersection.y)
|
||||||
|
.abs()
|
||||||
|
.pow(2),
|
||||||
|
)
|
||||||
|
.sqrt()
|
||||||
|
.toNumber()
|
||||||
|
oppositeHipPoints.push({ x: intersection.x, y: intersection.y, size })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nextLine.attributes.type === LINE_TYPE.WALLLINE.EAVES && afterNextLine.line.attributes.type === LINE_TYPE.WALLLINE.EAVES) {
|
||||||
|
let hipVector = getHalfAngleVector(nextLine, afterNextLine.line)
|
||||||
|
/** 이전 라인과의 사이 추녀마루의 각도를 확인한다, 각도가 지붕안쪽으로 향하지 않을때 반대로 처리한다.*/
|
||||||
|
const checkPoint = {
|
||||||
|
x: Big(nextLine.x1).plus(Big(hipVector.x).times(10)),
|
||||||
|
y: Big(nextLine.y1).plus(Big(hipVector.y).times(10)),
|
||||||
|
}
|
||||||
|
if (!checkWallPolygon.inPolygon(checkPoint)) {
|
||||||
|
hipVector = { x: -hipVector.x, y: -hipVector.y }
|
||||||
|
}
|
||||||
|
|
||||||
|
const hipEdge = {
|
||||||
|
vertex1: { x: nextLine.x2, y: nextLine.y2 },
|
||||||
|
vertex2: {
|
||||||
|
x: Big(nextLine.x2).plus(Big(hipVector.x).times(nextLine.attributes.planeSize)).toNumber(),
|
||||||
|
y: Big(nextLine.y2).plus(Big(hipVector.y).times(nextLine.attributes.planeSize)).toNumber(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const intersection = edgesIntersection(ridgeEdge, hipEdge)
|
||||||
|
if (intersection) {
|
||||||
|
const size = Big(points[0] - intersection.x)
|
||||||
|
.abs()
|
||||||
|
.pow(2)
|
||||||
|
.plus(
|
||||||
|
Big(points[1] - intersection.y)
|
||||||
|
.abs()
|
||||||
|
.pow(2),
|
||||||
|
)
|
||||||
|
.sqrt()
|
||||||
|
.toNumber()
|
||||||
|
oppositeHipPoints.push({ x: intersection.x, y: intersection.y, size })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (oppositeHipPoints.length > 0) {
|
||||||
|
const oppositeHipPoint = oppositeHipPoints.sort((a, b) => a.size - b.size)[0]
|
||||||
|
points[2] = oppositeHipPoint.x
|
||||||
|
points[3] = oppositeHipPoint.y
|
||||||
|
}
|
||||||
|
|
||||||
/** 동일 라인이 있는지 확인. */
|
/** 동일 라인이 있는지 확인. */
|
||||||
if (
|
if (
|
||||||
baseRidgeLines.filter((line) => {
|
baseRidgeLines.filter((line) => {
|
||||||
@ -5423,7 +5497,10 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ridgeLine = drawRidgeLine(points, canvas, roof, textMode)
|
const ridgeLine = drawRidgeLine(points, canvas, roof, textMode)
|
||||||
if (gableType.includes(beforePrevLine.line.attributes.type) || gableType.includes(afterNextLine.line.attributes.type)) {
|
if (
|
||||||
|
oppositeHipPoints.length === 0 &&
|
||||||
|
(gableType.includes(beforePrevLine.line.attributes.type) || gableType.includes(afterNextLine.line.attributes.type))
|
||||||
|
) {
|
||||||
baseGableRidgeLines.push(ridgeLine)
|
baseGableRidgeLines.push(ridgeLine)
|
||||||
} else {
|
} else {
|
||||||
baseRidgeLines.push(ridgeLine)
|
baseRidgeLines.push(ridgeLine)
|
||||||
@ -5453,7 +5530,10 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
|||||||
nextHipLine.fire('modified')
|
nextHipLine.fire('modified')
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
|
|
||||||
if (gableType.includes(beforePrevLine.line.attributes.type) || gableType.includes(afterNextLine.line.attributes.type)) {
|
if (
|
||||||
|
oppositeHipPoints.length === 0 &&
|
||||||
|
(gableType.includes(beforePrevLine.line.attributes.type) || gableType.includes(afterNextLine.line.attributes.type))
|
||||||
|
) {
|
||||||
const oppositeLine = gableType.includes(beforePrevLine.line.attributes.type) ? beforePrevLine.line : afterNextLine.line
|
const oppositeLine = gableType.includes(beforePrevLine.line.attributes.type) ? beforePrevLine.line : afterNextLine.line
|
||||||
if (Math.sign(ridgeLine.x1 - ridgeLine.x2) === 0) {
|
if (Math.sign(ridgeLine.x1 - ridgeLine.x2) === 0) {
|
||||||
const gableVector = Math.sign(ridgeLine.x1 - oppositeLine.x1)
|
const gableVector = Math.sign(ridgeLine.x1 - oppositeLine.x1)
|
||||||
@ -6072,22 +6152,12 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
|||||||
})
|
})
|
||||||
intersectRidgePoints.sort((prev, current) => prev.size.minus(current.size).toNumber())
|
intersectRidgePoints.sort((prev, current) => prev.size.minus(current.size).toNumber())
|
||||||
if (intersectRidgePoints.length > 0) {
|
if (intersectRidgePoints.length > 0) {
|
||||||
const oldPlaneSize = hipLine.line.attributes.planeSize
|
|
||||||
const oldActualSize = hipLine.line.attributes.actualSize
|
|
||||||
const theta = Big(Math.acos(Big(oldPlaneSize).div(oldActualSize)))
|
|
||||||
.times(180)
|
|
||||||
.div(Math.PI)
|
|
||||||
const planeSize = calcLinePlaneSize({
|
|
||||||
x1: hipLine.line.x1,
|
|
||||||
y1: hipLine.line.y1,
|
|
||||||
x2: hipLine.line.x2,
|
|
||||||
y2: hipLine.line.y2,
|
|
||||||
})
|
|
||||||
hipLine.x2 = intersectRidgePoints[0].x
|
hipLine.x2 = intersectRidgePoints[0].x
|
||||||
hipLine.y2 = intersectRidgePoints[0].y
|
hipLine.y2 = intersectRidgePoints[0].y
|
||||||
hipLine.line.set({ x2: intersectRidgePoints[0].x, y2: intersectRidgePoints[0].y })
|
hipLine.line.set({ x2: intersectRidgePoints[0].x, y2: intersectRidgePoints[0].y })
|
||||||
hipLine.line.attributes.planeSize = planeSize
|
const hipSize = reCalculateSize(hipLine.line)
|
||||||
hipLine.line.attributes.actualSize = planeSize === oldActualSize ? 0 : Big(planeSize).div(theta).round(1).toNumber()
|
hipLine.line.attributes.planeSize = hipSize.planeSize
|
||||||
|
hipLine.line.attributes.actualSize = hipSize.actualSize
|
||||||
hipLine.line.fire('modified')
|
hipLine.line.fire('modified')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user