diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-06-06 18:12:49 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-06-06 18:13:02 +0300 |
commit | 3a7af37e280276026e937aa95aefde11290741d2 (patch) | |
tree | ce4843dcc7ace5705146f0e3104deb1517a98947 /doc/python_api/examples/mathutils.kdtree.py | |
parent | 3abb1695cfb177c0d8dbff89740ab2ca069c856e (diff) |
Python API Docs: fix some examples
Diffstat (limited to 'doc/python_api/examples/mathutils.kdtree.py')
-rw-r--r-- | doc/python_api/examples/mathutils.kdtree.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/doc/python_api/examples/mathutils.kdtree.py b/doc/python_api/examples/mathutils.kdtree.py index 18e61a2bc58..8799f4ecb96 100644 --- a/doc/python_api/examples/mathutils.kdtree.py +++ b/doc/python_api/examples/mathutils.kdtree.py @@ -4,9 +4,6 @@ import mathutils from bpy import context obj = context.object -# 3d cursor relative to the object data -co_find = context.scene.cursor_location * obj.matrix_world.inverted() - mesh = obj.data size = len(mesh.vertices) kd = mathutils.kdtree.KDTree(size) @@ -22,6 +19,8 @@ co_find = (0.0, 0.0, 0.0) co, index, dist = kd.find(co_find) print("Close to center:", co, index, dist) +# 3d cursor relative to the object data +co_find = obj.matrix_world.inverted() @ context.scene.cursor.location # Find the closest 10 points to the 3d cursor print("Close 10 points") @@ -31,6 +30,5 @@ for (co, index, dist) in kd.find_n(co_find, 10): # Find points within a radius of the 3d cursor print("Close points within 0.5 distance") -co_find = context.scene.cursor_location for (co, index, dist) in kd.find_range(co_find, 0.5): print(" ", co, index, dist) |