diff --git a/object_fracture_cell/__init__.py b/object_fracture_cell/__init__.py index d284e205b4dc9ed5bb1817f254afc65fb786c9a6..0fcf794097ce04f1e9ffa15d8b8edb54be5729a7 100644 --- a/object_fracture_cell/__init__.py +++ b/object_fracture_cell/__init__.py @@ -24,10 +24,10 @@ bl_info = { "location": "Search > Fracture Object & Add -> Fracture Helper Objects", "description": "Fractured Object, Bomb, Projectile, Recorder", "warning": "", - "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\ - "Scripts/Object/Fracture", - "tracker_url": "https://projects.blender.org/tracker/index.php?"\ - "func=detail&aid=21793", + "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/" + "Scripts/Object/Fracture", + "tracker_url": "https://projects.blender.org/tracker/index.php?" + "func=detail&aid=21793", "category": "Object"} diff --git a/object_fracture_cell/fracture_cell_calc.py b/object_fracture_cell/fracture_cell_calc.py index 3b9e5a16dc84e8e81025392dda28c200965b771c..d75f6994ca11629a22a51fca9bdc7e83a868db3e 100644 --- a/object_fracture_cell/fracture_cell_calc.py +++ b/object_fracture_cell/fracture_cell_calc.py @@ -24,6 +24,7 @@ def points_as_bmesh_cells(verts, points, margin_bounds=0.05, margin_cell=0.0): + from math import sqrt import mathutils from mathutils import Vector @@ -79,11 +80,14 @@ def points_as_bmesh_cells(verts, points, if len(plane_indices) != len(planes): planes[:] = [planes[k] for k in plane_indices] - distance_max = vertices[0].length - for k in range(1, len(vertices)): - distance = vertices[k].length + # for comparisons use length_squared and delay + # converting to a real length until the end. + distance_max = 10000000000.0 # a big value! + for v in vertices: + distance = v.length_squared if distance_max < distance: distance_max = distance + distance_max = sqrt(distance_max) # make real length distance_max *= 2.0 if len(vertices) == 0: