Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-06-04 14:40:21 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-06-04 14:40:21 +0300
commit4b44a84b7cd40a12525ac0db8271f2da119f3758 (patch)
treeddb2e9d765353dce33b3adfc59807f1bae3bd832 /mesh_looptools.py
parenteaf15114f3ce36feccab12c9bfc0d7cdd48bb514 (diff)
Partial fix for T44469: Do not fail because of division by zero.
This only fixes the 'symptoms', root of the issue here is that we get a weird covariance matrix - Blender's own invert function errors on it, this script's matrix_invert func does give some result, but in any case final result is not what one would expect...
Diffstat (limited to 'mesh_looptools.py')
-rw-r--r--mesh_looptools.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/mesh_looptools.py b/mesh_looptools.py
index 49a26c48..1acd7a9d 100644
--- a/mesh_looptools.py
+++ b/mesh_looptools.py
@@ -19,7 +19,7 @@
bl_info = {
"name": "LoopTools",
"author": "Bart Crouch",
- "version": (4, 6, 5),
+ "version": (4, 6, 6),
"blender": (2, 72, 2),
"location": "View3D > Toolbar and View3D > Specials (W-key)",
"warning": "",
@@ -260,15 +260,14 @@ def calculate_plane(bm_mod, loop, method="best_fit", object=False):
if not normal:
# warning! this is different from .normalize()
itermax = 500
- iter = 0
- vec = mathutils.Vector((1.0, 1.0, 1.0))
- vec2 = (mat * vec)/(mat * vec).length
- while vec != vec2 and iter<itermax:
- iter+=1
+ vec2 = mathutils.Vector((1.0, 1.0, 1.0))
+ for i in range(itermax):
vec = vec2
vec2 = mat * vec
if vec2.length != 0:
vec2 /= vec2.length
+ if vec2 == vec:
+ break
if vec2.length == 0:
vec2 = mathutils.Vector((1.0, 1.0, 1.0))
normal = vec2