From 9ae7f21c8199c45e1f8c762d6763f7e8d3bb710c Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Tue, 17 Aug 2021 18:49:49 -0400 Subject: [PATCH] rebuild full --- CHANGELOG.md | 1 + src/face.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22f0c0a4..2b1333d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Repository: **** ### **HEAD -> main** 2021/08/17 mandic00@live.com +- improve face box caching - strict type checks - add webgu checks - experimental webgpu support diff --git a/src/face.ts b/src/face.ts index ff15bf44..32c321a5 100644 --- a/src/face.ts +++ b/src/face.ts @@ -70,7 +70,9 @@ const calculateFaceAngle = (face, imageSize): { const rotationMatrixToEulerAngle = (r) => { // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars const [r00, r01, r02, r10, r11, r12, r20, r21, r22] = r; - let thetaX; let thetaY; let thetaZ; + let thetaX: number; + let thetaY: number; + let thetaZ: number; if (r10 < 1) { // YZX calculation if (r10 > -1) { thetaZ = Math.asin(r10); @@ -86,9 +88,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; + 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