[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3583] trunk/py/scripts/addons/ object_fracture_cell: minor improvement to cell fracture algo.
Campbell Barton
ideasman42 at gmail.com
Thu Jul 5 09:54:57 CEST 2012
Revision: 3583
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3583
Author: campbellbarton
Date: 2012-07-05 07:54:56 +0000 (Thu, 05 Jul 2012)
Log Message:
-----------
minor improvement to cell fracture algo.
Modified Paths:
--------------
trunk/py/scripts/addons/object_fracture_cell/__init__.py
trunk/py/scripts/addons/object_fracture_cell/fracture_cell_calc.py
Modified: trunk/py/scripts/addons/object_fracture_cell/__init__.py
===================================================================
--- trunk/py/scripts/addons/object_fracture_cell/__init__.py 2012-07-05 01:23:57 UTC (rev 3582)
+++ trunk/py/scripts/addons/object_fracture_cell/__init__.py 2012-07-05 07:54:56 UTC (rev 3583)
@@ -24,10 +24,10 @@
"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"}
Modified: trunk/py/scripts/addons/object_fracture_cell/fracture_cell_calc.py
===================================================================
--- trunk/py/scripts/addons/object_fracture_cell/fracture_cell_calc.py 2012-07-05 01:23:57 UTC (rev 3582)
+++ trunk/py/scripts/addons/object_fracture_cell/fracture_cell_calc.py 2012-07-05 07:54:56 UTC (rev 3583)
@@ -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 @@
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:
More information about the Bf-extensions-cvs
mailing list