마루 지붕 처마 길이 오류 수정

This commit is contained in:
Jaeyoung Lee 2024-11-08 16:27:06 +09:00
parent c30defecc9
commit 73829ff5dd
2 changed files with 14 additions and 2 deletions

View File

@ -440,7 +440,16 @@ export default function Roof2(props) {
{ x: 1457, y: 178 }, { 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', fill: 'transparent',
stroke: 'green', stroke: 'green',
strokeWidth: 1, strokeWidth: 1,

View File

@ -1338,6 +1338,7 @@ const drawRidge = (roof, canvas) => {
ridgeMaxLength = Math.min(prevRoof.attributes.planeSize, nextRoof.attributes.planeSize), // 지붕의 최대 길이. 이전, 다음 벽 중 짧은 길이 ridgeMaxLength = Math.min(prevRoof.attributes.planeSize, nextRoof.attributes.planeSize), // 지붕의 최대 길이. 이전, 다음 벽 중 짧은 길이
ridgeAcrossLength = Math.abs(Math.max(prevRoof.attributes.planeSize, nextRoof.attributes.planeSize) - currentRoof.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 let acrossRoof = anotherRoof
.filter((roof) => { .filter((roof) => {
const angle1 = calculateAngle(currentRoof.startPoint, currentRoof.endPoint) const angle1 = calculateAngle(currentRoof.startPoint, currentRoof.endPoint)
@ -1423,6 +1424,8 @@ const drawRidge = (roof, canvas) => {
ridgeMaxLength = ridgeMaxLength / 10 ridgeMaxLength = ridgeMaxLength / 10
ridgeAcrossLength = ridgeAcrossLength / 10 ridgeAcrossLength = ridgeAcrossLength / 10
console.log('ridgeBaseLength', ridgeBaseLength, 'ridgeMaxLength', ridgeMaxLength, 'ridgeAcrossLength', ridgeAcrossLength)
if (ridgeBaseLength > 0 && ridgeMaxLength > 0 && ridgeAcrossLength > 0) { if (ridgeBaseLength > 0 && ridgeMaxLength > 0 && ridgeAcrossLength > 0) {
let ridgeLength = Math.min(ridgeMaxLength, ridgeAcrossLength) let ridgeLength = Math.min(ridgeMaxLength, ridgeAcrossLength)
if (currentRoof.x1 === currentRoof.x2) { if (currentRoof.x1 === currentRoof.x2) {
@ -1776,7 +1779,7 @@ const drawHips = (roof, canvas) => {
}) })
canvas.add(hip) canvas.add(hip)
const hipBase = ((Math.abs(hip.x1 - hip.x2) + Math.abs(hip.y1 - hip.y2)) / 2) * 10 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 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) { if (prevDegree === currentDegree) {
hip.attributes.actualSize = Math.round(Math.sqrt(Math.pow(hip.attributes.planeSize, 2) + Math.pow(hipHeight, 2))) hip.attributes.actualSize = Math.round(Math.sqrt(Math.pow(hip.attributes.planeSize, 2) + Math.pow(hipHeight, 2)))