From 7f4f138adaf6afffb98aa75d7847fce49ada23c3 Mon Sep 17 00:00:00 2001 From: Jaeyoung Lee Date: Thu, 13 Feb 2025 11:27:40 +0900 Subject: [PATCH] =?UTF-8?q?point=20=EA=B0=81=EB=8F=84=20=EA=B3=84=EC=82=B0?= =?UTF-8?q?=EC=8B=9C=20point=EA=B0=80=20=EC=97=86=EB=8A=94=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/qpolygon-utils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/util/qpolygon-utils.js b/src/util/qpolygon-utils.js index c2c73775..9fdd7275 100644 --- a/src/util/qpolygon-utils.js +++ b/src/util/qpolygon-utils.js @@ -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) }