From 71e564e02a0a7c8c0129fc5fa632af23a3fb2a2e Mon Sep 17 00:00:00 2001
From: Bastien Montagne <montagne29@wanadoo.fr>
Date: Fri, 2 May 2014 23:07:15 +0200
Subject: [PATCH] FBX export: Fix to 'nearly equal' func (would break when both
 values were 0).

---
 io_scene_fbx/export_fbx_bin.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 464ed5d7e..393005dee 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -136,7 +136,10 @@ def matrix_to_array(mat):
 
 def similar_values(v1, v2, e=1e-6):
     """Return True if v1 and v2 are nearly the same."""
-    return abs(v1 - v2) * max(abs(v1), abs(v2)) <= e
+    if v1 == v2:
+        return True
+    return ((abs(v1 - v2) / max(abs(v1), abs(v2))) <= e)
+
 
 RIGHT_HAND_AXES = {
     # Up, Front -> FBX values (tuples of (axis, sign), Up, Front, Coord).
-- 
GitLab