치수선 변경 계산식 수정
This commit is contained in:
parent
ad37a2465d
commit
6a18c93fbc
@ -9,7 +9,7 @@ import { canvasState, pitchTextSelector } from '@/store/canvasAtom'
|
|||||||
import { defaultSlope } from '@/store/commonAtom'
|
import { defaultSlope } from '@/store/commonAtom'
|
||||||
import { re } from 'mathjs'
|
import { re } from 'mathjs'
|
||||||
import { basicSettingState } from '@/store/settingAtom'
|
import { basicSettingState } from '@/store/settingAtom'
|
||||||
import { getChonByDegree } from '@/util/canvas-util'
|
import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
|
||||||
|
|
||||||
export default function DimensionLineSetting(props) {
|
export default function DimensionLineSetting(props) {
|
||||||
const contextPopupPosition = useRecoilValue(contextPopupPositionState)
|
const contextPopupPosition = useRecoilValue(contextPopupPositionState)
|
||||||
@ -106,14 +106,14 @@ export default function DimensionLineSetting(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const calculateLength = (originalLength, angle, angle1) => {
|
const calculateLength = (originalLength, angle, angle1) => {
|
||||||
const slope1 = basicSetting.roofAngleSet !== 'slope' ? getChonByDegree(angle) : angle
|
|
||||||
const slope2 = basicSetting.roofAngleSet !== 'slope' ? getChonByDegree(angle1 ?? 0) : angle1
|
|
||||||
if (!angle1) {
|
if (!angle1) {
|
||||||
const angleInRadians = slope1 * (Math.PI / 180)
|
const slope1 = basicSetting.roofAngleSet !== 'slope' ? getDegreeByChon(angle) : angle
|
||||||
const result = Math.sqrt(Math.pow(originalLength * Math.tan(angleInRadians), 2) + Math.pow(originalLength, 2))
|
const result = Math.sqrt(Math.pow(originalLength * Math.tan((getDegreeByChon(slope1) * Math.PI) / 180), 2) + Math.pow(originalLength, 2))
|
||||||
console.log(angleInRadians, result)
|
console.log(result)
|
||||||
return result
|
return result
|
||||||
} else {
|
} else {
|
||||||
|
const slope1 = basicSetting.roofAngleSet !== 'slope' ? getChonByDegree(angle) : angle
|
||||||
|
const slope2 = basicSetting.roofAngleSet !== 'slope' ? getChonByDegree(angle1 ?? 0) : angle1
|
||||||
const numerator = Math.sqrt(Math.pow(slope1, 2) + 100 + Math.pow((10 * slope1) / slope2, 2)) * originalLength
|
const numerator = Math.sqrt(Math.pow(slope1, 2) + 100 + Math.pow((10 * slope1) / slope2, 2)) * originalLength
|
||||||
const denominator = Math.sqrt(Math.pow((10 * slope1) / slope2, 2) + 100)
|
const denominator = Math.sqrt(Math.pow((10 * slope1) / slope2, 2) + 100)
|
||||||
const result = numerator / denominator
|
const result = numerator / denominator
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user