From 2729427d858150ba821757b26808cdc8591d7b11 Mon Sep 17 00:00:00 2001 From: "lkh14011424@gmail.com" Date: Fri, 27 Sep 2024 05:17:03 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[feat/#46]=20=EA=BC=AC=EB=A6=AC=EB=BC=88=20?= =?UTF-8?q?=EC=95=89=EA=B8=B0=20=ED=83=90=EC=A7=80=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/detector.ts | 51 ++++++------------------------------------- 1 file changed, 7 insertions(+), 44 deletions(-) diff --git a/src/utils/detector.ts b/src/utils/detector.ts index 6b8c136..6660ee3 100644 --- a/src/utils/detector.ts +++ b/src/utils/detector.ts @@ -315,51 +315,14 @@ export const detectTailboneSit = (refer: pose[], comp: pose[]): boolean | null = // 귀의 중점 계산 const compShoulderMidpoint = getMidPoint(compLeftShoulder, compRightShoulder) - const referForwardHeadDistance = Math.max(referLeftShoulder.y, referRightShoulder.y) - referEarMidpoint.y - const compForwardHeadDistance = Math.max(compLeftShoulder.y, compRightShoulder.y) - compEarMidpoint.y - - const referShoulderSlope = getSlopeFromPoints(referLeftShoulder, referRightShoulder) - - // 2. 왼쪽 어깨-왼쪽 귀를 잇는 직선의 기울기 - const referLeftShoulderEarSlope = getSlopeFromPoints(referLeftShoulder, referLeftEar) - - // 3. 오른쪽 어깨-오른쪽 귀를 잇는 직선의 기울기 - const referRightShoulderEarSlope = getSlopeFromPoints(referRightShoulder, referRightEar) - - const compShoulderSlope = getSlopeFromPoints(compLeftShoulder, compRightShoulder) - - // 2. 왼쪽 어깨-왼쪽 귀를 잇는 직선의 기울기 - const compLeftShoulderEarSlope = getSlopeFromPoints(compLeftShoulder, compLeftEar) - - // 3. 오른쪽 어깨-오른쪽 귀를 잇는 직선의 기울기 - const compRightShoulderEarSlope = getSlopeFromPoints(compRightShoulder, compRightEar) - - const referLeftAngle = getAngleBetweenLines(referShoulderSlope, referLeftShoulderEarSlope) - const referRightAngle = getAngleBetweenLines(referShoulderSlope, referRightShoulderEarSlope) - - const compLeftAngle = getAngleBetweenLines(compShoulderSlope, compLeftShoulderEarSlope) - const compRightAngle = getAngleBetweenLines(compShoulderSlope, compRightShoulderEarSlope) - - const referAngleRatio = 1 / (referLeftAngle + referRightAngle) - const compAngleRatio = 1 / (compLeftAngle + compRightAngle) - const referCorrectRatio = (0.4 * referForwardHeadDistance) / (1.5 * referEarDistance + 0.3 * referShoulderDistance) - const compCorrectRatio = (0.4 * compForwardHeadDistance) / (1.5 * compEarDistance + 0.3 * compShoulderDistance) - - const referRatio = 0.7 * referCorrectRatio + 0.3 * referAngleRatio - const compRatio = 0.7 * compCorrectRatio + 0.3 * compAngleRatio - - const referShoulderMidPointY = referShoulderMidpoint?.y || 1 // 기본값 설정 (1로 설정하여 0으로 나누기 방지) - const compShoulderMidPointY = compShoulderMidpoint?.y || 1 // 기본값 설정 - - const RATIO_DIFF_THRESHOLD = 0.88 - - const referAngle = getAngleBetweenLines(referRightShoulderEarSlope, referLeftShoulderEarSlope) - const compAngle = getAngleBetweenLines(compLeftShoulderEarSlope, compRightShoulderEarSlope) - + const referRatio = referEarDistance / referShoulderDistance + const compRatio = compEarDistance / compShoulderDistance if ( - referRatio * RATIO_DIFF_THRESHOLD > compRatio && - referShoulderMidPointY < compShoulderMidPointY && - referAngle * 1.2 < compAngle + compShoulderDistance / referShoulderDistance < 0.88 && + compEarDistance / referEarDistance < 0.88 && + referShoulderMidpoint.y < compShoulderMidpoint.y && + referEarMidpoint.y < compEarMidpoint.y && + Math.abs(referRatio - compRatio) > 0.018 ) { return true } else { From 310516527aa4dc44a4b22dbd4799cc8a3cd7ae4b Mon Sep 17 00:00:00 2001 From: "lkh14011424@gmail.com" Date: Fri, 27 Sep 2024 05:22:00 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[feat/#46]=20=EA=BC=AC=EB=A6=AC=EB=BC=88?= =?UTF-8?q?=EB=A1=9C=20=EC=95=89=EA=B8=B0=20=EA=B0=90=EB=8F=84=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/detector.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/detector.ts b/src/utils/detector.ts index 6660ee3..a941b63 100644 --- a/src/utils/detector.ts +++ b/src/utils/detector.ts @@ -317,12 +317,13 @@ export const detectTailboneSit = (refer: pose[], comp: pose[]): boolean | null = const referRatio = referEarDistance / referShoulderDistance const compRatio = compEarDistance / compShoulderDistance + if ( - compShoulderDistance / referShoulderDistance < 0.88 && - compEarDistance / referEarDistance < 0.88 && + compShoulderDistance / referShoulderDistance < 0.9 && + compEarDistance / referEarDistance < 0.9 && referShoulderMidpoint.y < compShoulderMidpoint.y && referEarMidpoint.y < compEarMidpoint.y && - Math.abs(referRatio - compRatio) > 0.018 + Math.abs(referRatio - compRatio) > 0.015 ) { return true } else { From cf4f0e78a63715acf4b7d5eead9c92f07422ec47 Mon Sep 17 00:00:00 2001 From: "lkh14011424@gmail.com" Date: Fri, 27 Sep 2024 05:43:17 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[feat/#46]=20=EB=A1=9C=EA=B3=A0=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD,=20=ED=91=B8=EC=8B=9C=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icons/home-logo.svg | 12 ++++++++++++ src/assets/icons/side-nav-logo.svg | 12 ++++++++++++ src/components/SideNav.tsx | 5 ++--- src/hooks/usePushNotification.ts | 2 ++ src/pages/HomePage.tsx | 13 ++++++++----- 5 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 src/assets/icons/home-logo.svg create mode 100644 src/assets/icons/side-nav-logo.svg diff --git a/src/assets/icons/home-logo.svg b/src/assets/icons/home-logo.svg new file mode 100644 index 0000000..b012c67 --- /dev/null +++ b/src/assets/icons/home-logo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/assets/icons/side-nav-logo.svg b/src/assets/icons/side-nav-logo.svg new file mode 100644 index 0000000..980c5b6 --- /dev/null +++ b/src/assets/icons/side-nav-logo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/components/SideNav.tsx b/src/components/SideNav.tsx index ba31b2b..0d3e52b 100644 --- a/src/components/SideNav.tsx +++ b/src/components/SideNav.tsx @@ -1,7 +1,7 @@ import { clearAccessToken } from "@/api/axiosInstance" import { useAuthStore } from "@/store/AuthStore" import { useSnapShotStore } from "@/store/SnapshotStore" -import MainCraftIcon from "@assets/icons/posture-craft-side-nav-icon.svg?react" +import LogoImage from "@assets/icons/side-nav-logo.svg?react" import AnalysisIcon from "@assets/icons/side-nav-analysis-icon.svg?react" import CrewIcon from "@assets/icons/side-nav-crew-icon.svg?react" import MonitoringIcon from "@assets/icons/side-nav-monitor-icon.svg?react" @@ -82,8 +82,7 @@ export default function SideNav(): React.ReactElement {
{/* Logo and Title */}
- - 자세공작소 +
{/* User Info */} diff --git a/src/hooks/usePushNotification.ts b/src/hooks/usePushNotification.ts index c83a4f9..6114d41 100644 --- a/src/hooks/usePushNotification.ts +++ b/src/hooks/usePushNotification.ts @@ -1,4 +1,5 @@ import { useState, useEffect, useRef } from "react" +import PushIcon from "@assets/icons/favicon.svg" interface UsePushNotificationResult { hasPermission: boolean @@ -53,6 +54,7 @@ const usePushNotification = (): UsePushNotificationResult => { if (hasPermissionRef.current) { new Notification("자세공작소", { body: body, + icon: PushIcon as string, }) } } diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index e7ccfbc..82d7c6f 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -1,4 +1,4 @@ -import MainCraftIcon from "@assets/icons/posture-craft-side-nav-icon.svg?react" +import LogoImage from "@assets/icons/home-logo.svg?react" import KakaoSignupIcon from "@assets/icons/home-kakao-signup-button-icon.svg?react" import IntroImage from "@/assets/images/home-intro.png" import MonitoringImage from "@/assets/images/home-monitoring.png" @@ -18,8 +18,7 @@ const HomePage: React.FC = () => {
{/* logo */}
- - 자세공작소 +