촌 계산 추가, type검사 수정
This commit is contained in:
parent
051ea87861
commit
68cb952b70
@ -81,7 +81,7 @@ export default class QPolygon extends fabric.Group {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.getObjects().forEach((obj) => {
|
this.getObjects().forEach((obj) => {
|
||||||
if (obj.type === 'QLine') {
|
if (obj.type[0] === 'Q') {
|
||||||
obj.setFontSize(fontSize)
|
obj.setFontSize(fontSize)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -222,8 +222,16 @@ export const getRoofHypotenuse = (base) => {
|
|||||||
return Math.sqrt(base * base * 2)
|
return Math.sqrt(base * base * 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 촌을 입력받아 각도를 반환
|
||||||
|
* @param chon
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
export const getDegreeByChon = (chon) => {
|
export const getDegreeByChon = (chon) => {
|
||||||
return chon * 5.45
|
// tan(theta) = height / base
|
||||||
|
const radians = Math.atan(chon / 10)
|
||||||
|
// 라디안을 도 단위로 변환
|
||||||
|
return Number((radians * (180 / Math.PI)).toFixed(2))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -265,6 +273,12 @@ export const getDirectionByPoint = (a, b) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* line을 두개를 이용해서 교차점을 찾는 함수
|
||||||
|
* @param line1
|
||||||
|
* @param line2
|
||||||
|
* @returns {{x: number, y: number}|null}
|
||||||
|
*/
|
||||||
export function calculateIntersection(line1, line2) {
|
export function calculateIntersection(line1, line2) {
|
||||||
const x1 = line1.x1,
|
const x1 = line1.x1,
|
||||||
y1 = line1.y1,
|
y1 = line1.y1,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user