From 649a3a17b5e4f02191b1a4b617012a5e66264fe3 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Tue, 17 Aug 2021 18:46:50 -0400 Subject: [PATCH] update angle calculations --- CHANGELOG.md | 5 ++--- src/face.ts | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 675f558d..22f0c0a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,8 @@ Repository: **** ### **HEAD -> main** 2021/08/17 mandic00@live.com - -### **origin/main** 2021/08/15 mandic00@live.com - +- strict type checks +- add webgu checks - experimental webgpu support - add experimental webgu demo - add backend initialization checks diff --git a/src/face.ts b/src/face.ts index 557d1089..ff15bf44 100644 --- a/src/face.ts +++ b/src/face.ts @@ -86,6 +86,9 @@ const calculateFaceAngle = (face, imageSize): { thetaY = Math.atan2(r21, r22); thetaX = 0; } + if (!isNaN(thetaX)) thetaX = 0; + if (!isNaN(thetaY)) thetaY = 0; + if (!isNaN(thetaZ)) thetaZ = 0; return { pitch: 2 * -thetaX, yaw: 2 * -thetaY, roll: 2 * -thetaZ }; }; // simple Euler angle calculation based existing 3D mesh