From cffe622ef2e677713997f92475507783806f6210 Mon Sep 17 00:00:00 2001 From: TigerKat Date: Tue, 6 Apr 2021 22:25:14 +0930 Subject: [PATCH] Fixed bugs in compression logic. --- compression_anim.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/compression_anim.py b/compression_anim.py index 283a21f..1451d9d 100644 --- a/compression_anim.py +++ b/compression_anim.py @@ -26,12 +26,12 @@ def compressQuaternion_5Byte(quat): for i in range(4): if i == missing: continue - v = int(math.round(q[i] / MAX_5_BYTE_QUATERNION * 2048)) + v = int(math.floor(0.5 + q[i] / MAX_5_BYTE_QUATERNION * 2048)) if v < -2048: v = -2048 elif v > 2047: v = 2047 - d.append(q[i] * 2048) + d.append(v + 2048) v = ( (missing << 36) | (d[0] << 24) | @@ -40,7 +40,7 @@ def compressQuaternion_5Byte(quat): ) s = struct.pack("