diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2019-10-18 20:22:48 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2019-10-18 20:22:48 +0300 |
commit | ee68a17611920264c4353a1fdc79f80be08fc710 (patch) | |
tree | 7a45c02a67a6cec96f891e64a48a5935d7076e09 /mesh_looptools.py | |
parent | 8615fd39580ecdc4f8167b9e7ecc1644e7c6abea (diff) |
Fix T70899: Looptools circle fails when new plane created aligned to view
loop tools uses a custom matrix inverse function with high precision.
So this precision has to extend to other parts.
Diffstat (limited to 'mesh_looptools.py')
-rw-r--r-- | mesh_looptools.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mesh_looptools.py b/mesh_looptools.py index 41c1be0a..67855477 100644 --- a/mesh_looptools.py +++ b/mesh_looptools.py @@ -19,7 +19,7 @@ bl_info = { "name": "LoopTools", "author": "Bart Crouch", - "version": (4, 6, 7), + "version": (4, 6, 8), "blender": (2, 80, 0), "location": "View3D > Sidebar > Edit Tab / Edit Mode Context Menu", "warning": "", @@ -290,8 +290,10 @@ def calculate_plane(bm_mod, loop, method="best_fit", object=False): for i in range(itermax): vec = vec2 vec2 = mat @ vec - if vec2.length != 0: - vec2 /= vec2.length + # Calculate length with double precision to avoid problems with `inf` + vec2_length = math.sqrt(vec2[0] ** 2 + vec2[1] ** 2 + vec2[2] ** 2) + if vec2_length != 0: + vec2 /= vec2_length if vec2 == vec: break if vec2.length == 0: |