From 0dbac3ab6922b04cc9b61148906af0d99b26cdf1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Nov 2006 00:13:38 +0000 Subject: [PATCH] attempt to make zero area faces result in NAN or INF loc verts happen less. --- release/scripts/bpymodules/BPyMesh_redux.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/release/scripts/bpymodules/BPyMesh_redux.py b/release/scripts/bpymodules/BPyMesh_redux.py index bb6976cd8f8..fa80a01f6ee 100644 --- a/release/scripts/bpymodules/BPyMesh_redux.py +++ b/release/scripts/bpymodules/BPyMesh_redux.py @@ -25,6 +25,7 @@ import Blender Vector= Blender.Mathutils.Vector Ang= Blender.Mathutils.AngleBetweenVecs CrossVecs= Blender.Mathutils.CrossVecs +MidpointVecs= Blender.Mathutils.MidpointVecs import BPyMesh # If python version is less than 2.4, try to get set stuff from module @@ -189,7 +190,7 @@ def redux(ob, REDUX=0.5, BOUNDRY_WEIGHT=2.0, REMOVE_DOUBLES=False, FACE_AREA_WEI w2/=wscale length= self.length - between= (v1co+v2co) * 0.5 + between= MidpointVecs(v1co, v2co) # Collapse # new_location = between # Replace tricky code below. this code predicts the best collapse location. @@ -202,8 +203,8 @@ def redux(ob, REDUX=0.5, BOUNDRY_WEIGHT=2.0, REMOVE_DOUBLES=False, FACE_AREA_WEI cv2= CrossVecs(v2no, CrossVecs(v2no, v2co-v1co)) # Scale to be less then the edge lengths. - cv1.normalize() - cv2.normalize() + cv2.length = cv1.length = 1 + cv1 = cv1 * (length* 0.4) cv2 = cv2 * (length* 0.4)