[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [829] branches/ivygen/ivy_functions.py: - added my own version of the 'get the distance' function
Florian Meyer
florianfelix at web.de
Wed Jul 21 11:31:33 CEST 2010
Revision: 829
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=829
Author: testscreenings
Date: 2010-07-21 11:31:32 +0200 (Wed, 21 Jul 2010)
Log Message:
-----------
- added my own version of the 'get the distance' function
- kodemax: i haven't run it but i am pretty sure this will work just the same as what you did
- have look at the use of the built in methods of the mathutils module
Modified Paths:
--------------
branches/ivygen/ivy_functions.py
Modified: branches/ivygen/ivy_functions.py
===================================================================
--- branches/ivygen/ivy_functions.py 2010-07-21 06:18:31 UTC (rev 828)
+++ branches/ivygen/ivy_functions.py 2010-07-21 09:31:32 UTC (rev 829)
@@ -154,8 +154,36 @@
+#################################################################################
+#################################################################################
+######### i think this should work ##############################################
+######### retrieving the face and distance to the nearest face of a mesh ########
+#################################################################################
+
+def distance(old_pos, ob)
+ distances = {}
+ for i, face in enumerate(obj.data.faces):
+
+ referencePoint = ob.data.verts[face.verts[0]] # Q
+ normal = face,normal # n
+ referenceVector = old_pos - referencePoint # vector n
+
+ distance = referenceVector.dot(n)
+ distances[distance] = i
+
+ distances, index = sortDict(distances)
+
+ return distance, index
+
+def sortDict(dict):
+ keys = dict.keys()
+ keys.sort()
+ distance = keys[0][0] # should maybe run this
+ index = keys[0][1] # if this data retrieval really works
+ return distance, index
+##################################################################################
@@ -164,9 +192,6 @@
-
-
-
def register():
pass
More information about the Bf-extensions-cvs
mailing list