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.
This commit is contained in:
Germano Cavalcante 2019-10-18 14:22:48 -03:00
parent 8615fd3958
commit ee68a17611
Notes: blender-bot 2023-02-14 00:28:07 +01:00
Referenced by issue blender/blender#70899, Looptools circle fails when new plane created aligned to view
1 changed files with 5 additions and 3 deletions

View File

@ -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: