attempt to make zero area faces result in NAN or INF loc verts happen less.

This commit is contained in:
Campbell Barton 2006-11-02 00:13:38 +00:00
parent b693662ba6
commit 0dbac3ab69

@ -25,6 +25,7 @@ import Blender
Vector= Blender.Mathutils.Vector Vector= Blender.Mathutils.Vector
Ang= Blender.Mathutils.AngleBetweenVecs Ang= Blender.Mathutils.AngleBetweenVecs
CrossVecs= Blender.Mathutils.CrossVecs CrossVecs= Blender.Mathutils.CrossVecs
MidpointVecs= Blender.Mathutils.MidpointVecs
import BPyMesh import BPyMesh
# If python version is less than 2.4, try to get set stuff from module # 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 w2/=wscale
length= self.length length= self.length
between= (v1co+v2co) * 0.5 between= MidpointVecs(v1co, v2co)
# Collapse # Collapse
# new_location = between # Replace tricky code below. this code predicts the best collapse location. # 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)) cv2= CrossVecs(v2no, CrossVecs(v2no, v2co-v1co))
# Scale to be less then the edge lengths. # Scale to be less then the edge lengths.
cv1.normalize() cv2.length = cv1.length = 1
cv2.normalize()
cv1 = cv1 * (length* 0.4) cv1 = cv1 * (length* 0.4)
cv2 = cv2 * (length* 0.4) cv2 = cv2 * (length* 0.4)