diff --git a/src/components/Roof2.jsx b/src/components/Roof2.jsx index 081eedc2..021357c4 100644 --- a/src/components/Roof2.jsx +++ b/src/components/Roof2.jsx @@ -440,7 +440,16 @@ export default function Roof2(props) { { x: 1457, y: 178 }, ] - const polygon = new QPolygon(test1, { + const test2 = [ + { x: 113, y: 114.9 }, + { x: 113, y: 371.9 }, + { x: 762, y: 371.9 }, + { x: 762, y: 818.7 }, + { x: 1468.6, y: 818.7 }, + { x: 1468.6, y: 114.9 }, + ] + + const polygon = new QPolygon(type2, { fill: 'transparent', stroke: 'green', strokeWidth: 1, diff --git a/src/util/qpolygon-utils.js b/src/util/qpolygon-utils.js index 679562ec..ed375ec5 100644 --- a/src/util/qpolygon-utils.js +++ b/src/util/qpolygon-utils.js @@ -1338,6 +1338,7 @@ const drawRidge = (roof, canvas) => { ridgeMaxLength = Math.min(prevRoof.attributes.planeSize, nextRoof.attributes.planeSize), // 지붕의 최대 길이. 이전, 다음 벽 중 짧은 길이 ridgeAcrossLength = Math.abs(Math.max(prevRoof.attributes.planeSize, nextRoof.attributes.planeSize) - currentRoof.attributes.planeSize) // 맞은편 벽까지의 길이 - 지붕의 기반 길이 + console.log('ridgeBaseLength', ridgeBaseLength, 'ridgeMaxLength', ridgeMaxLength, 'ridgeAcrossLength', ridgeAcrossLength) let acrossRoof = anotherRoof .filter((roof) => { const angle1 = calculateAngle(currentRoof.startPoint, currentRoof.endPoint) @@ -1423,6 +1424,8 @@ const drawRidge = (roof, canvas) => { ridgeMaxLength = ridgeMaxLength / 10 ridgeAcrossLength = ridgeAcrossLength / 10 + console.log('ridgeBaseLength', ridgeBaseLength, 'ridgeMaxLength', ridgeMaxLength, 'ridgeAcrossLength', ridgeAcrossLength) + if (ridgeBaseLength > 0 && ridgeMaxLength > 0 && ridgeAcrossLength > 0) { let ridgeLength = Math.min(ridgeMaxLength, ridgeAcrossLength) if (currentRoof.x1 === currentRoof.x2) { @@ -1776,7 +1779,7 @@ const drawHips = (roof, canvas) => { }) canvas.add(hip) const hipBase = ((Math.abs(hip.x1 - hip.x2) + Math.abs(hip.y1 - hip.y2)) / 2) * 10 - const hipHeight = Math.round(hipBase / Math.tan(((90 - currentRoof.attributes.degree) * Math.PI) / 180)) + const hipHeight = Math.round(hipBase / Math.tan(((90 - currentDegree) * Math.PI) / 180)) hip.attributes.planeSize = Math.round(Math.sqrt(Math.pow(hip.x1 - hip.x2, 2) + Math.pow(hip.y1 - hip.y2, 2))) * 10 if (prevDegree === currentDegree) { hip.attributes.actualSize = Math.round(Math.sqrt(Math.pow(hip.attributes.planeSize, 2) + Math.pow(hipHeight, 2)))