Merge branch 'feature/jaeyoung' into dev

This commit is contained in:
Jaeyoung Lee 2025-02-13 11:28:00 +09:00
commit 55b29bfdd3

View File

@ -23,8 +23,12 @@ export const defineQPloygon = () => {
* @returns {number}
*/
export const calculateAngle = (point1, point2) => {
const deltaX = Big(point2.x).minus(point1.x).toNumber()
const deltaY = Big(point2.y).minus(point1.y).toNumber()
const deltaX = Big(point2?.x !== undefined ? point2.x : 0)
.minus(point1?.x !== undefined ? point1.x : 0)
.toNumber()
const deltaY = Big(point2?.y !== undefined ? point2.y : 0)
.minus(point1?.y !== undefined ? point1.y : 0)
.toNumber()
const angleInRadians = Math.atan2(deltaY, deltaX)
return angleInRadians * (180 / Math.PI)
}