처마면 오류 수정

This commit is contained in:
yjnoh 2024-12-04 14:57:46 +09:00
parent 69d11336d5
commit 5cb50ae21e

View File

@ -10,6 +10,7 @@ import { POLYGON_TYPE, BATCH_TYPE } from '@/common/common'
import * as turf from '@turf/turf' import * as turf from '@turf/turf'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import { useSwal } from '@/hooks/useSwal' import { useSwal } from '@/hooks/useSwal'
import { canvasSettingState } from '@/store/canvasAtom'
export function useModuleBasicSetting() { export function useModuleBasicSetting() {
const canvas = useRecoilValue(canvasState) const canvas = useRecoilValue(canvasState)
@ -18,7 +19,7 @@ export function useModuleBasicSetting() {
const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState) const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState)
const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useEvent() const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useEvent()
const { swalFire } = useSwal() const { swalFire } = useSwal()
const canvasSetting = useRecoilValue(canvasSettingState)
// const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext) // const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext)
let selectedModuleInstSurfaceArray = [] let selectedModuleInstSurfaceArray = []
@ -64,6 +65,8 @@ export function useModuleBasicSetting() {
const surfaceId = uuidv4() const surfaceId = uuidv4()
console.log('roof.moduleCompass', roof.moduleCompass)
let setupSurface = new QPolygon(offsetPoints, { let setupSurface = new QPolygon(offsetPoints, {
stroke: 'red', stroke: 'red',
fill: 'transparent', fill: 'transparent',
@ -815,9 +818,9 @@ export function useModuleBasicSetting() {
if (isMaxSetup) totalHeight = totalHeight * 2 //최대배치시 2배로 늘려서 반씩 검사 if (isMaxSetup) totalHeight = totalHeight * 2 //최대배치시 2배로 늘려서 반씩 검사
for (let i = 0; i <= totalWidth; i++) { for (let i = 0; i <= totalWidth; i++) {
bottomMargin = j === 0 ? 1 : 2 bottomMargin = i === 0 ? 1 : 2
for (let j = 0; j < totalHeight; j++) { for (let j = 0; j < totalHeight; j++) {
leftMargin = i === 0 ? 1 : 2 leftMargin = j === 0 ? 1 : 2
chidoriLength = 0 chidoriLength = 0
if (isChidori) { if (isChidori) {
chidoriLength = i % 2 === 0 ? 0 : height / 2 chidoriLength = i % 2 === 0 ? 0 : height / 2
@ -1203,7 +1206,7 @@ export function useModuleBasicSetting() {
const angle2 = Math.abs(Math.round(Math.atan(height2 / adjust2) * (180 / Math.PI) * 1000) / 1000) const angle2 = Math.abs(Math.round(Math.atan(height2 / adjust2) * (180 / Math.PI) * 1000) / 1000)
const angle3 = 180 - (angle1 + angle2) const angle3 = 180 - (angle1 + angle2)
const charlie = 173.3 + 3 // 평행선길이 약간 여유를 줌 const charlie = 173.3 // 평행선길이 약간 여유를 줌
const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180) const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180)
const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180)) const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180))
const h = beta * Math.sin((angle1 * Math.PI) / 180) // 높이 const h = beta * Math.sin((angle1 * Math.PI) / 180) // 높이
@ -1318,7 +1321,7 @@ export function useModuleBasicSetting() {
const angle2 = Math.abs(Math.round(Math.atan(adjust2 / height2) * (180 / Math.PI) * 1000) / 1000) const angle2 = Math.abs(Math.round(Math.atan(adjust2 / height2) * (180 / Math.PI) * 1000) / 1000)
const angle3 = 180 - (angle1 + angle2) const angle3 = 180 - (angle1 + angle2)
const charlie = 173.3 + 3 // 평행선길이 약간 여유를줌 const charlie = 173.3 // 평행선길이 약간 여유를줌
const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180) const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180)
const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180)) const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180))
@ -1434,10 +1437,16 @@ export function useModuleBasicSetting() {
return obj return obj
} }
const manualFlatroofModuleSetup = () => {}
const autoFlatroofModuleSetup = (placementFlatRef) => {}
return { return {
makeModuleInstArea, makeModuleInstArea,
manualModuleSetup, manualModuleSetup,
autoModuleSetup, autoModuleSetup,
restoreModuleInstArea, restoreModuleInstArea,
manualFlatroofModuleSetup,
autoFlatroofModuleSetup,
} }
} }