From 73829ff5dd66284f91f4e490977c7e8c09bb7313 Mon Sep 17 00:00:00 2001 From: Jaeyoung Lee Date: Fri, 8 Nov 2024 16:27:06 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A7=88=EB=A3=A8=20=EC=A7=80=EB=B6=95=20?= =?UTF-8?q?=EC=B2=98=EB=A7=88=20=EA=B8=B8=EC=9D=B4=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Roof2.jsx | 11 ++++++++++- src/util/qpolygon-utils.js | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) 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)))