[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [823] branches/ivygen/ivy_functions.py: - in this file
Florian Meyer
florianfelix at web.de
Tue Jul 20 23:34:48 CEST 2010
Revision: 823
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=823
Author: testscreenings
Date: 2010-07-20 23:34:48 +0200 (Tue, 20 Jul 2010)
Log Message:
-----------
- in this file
- previous commit just added undo, deactivation-activation
Modified Paths:
--------------
branches/ivygen/ivy_functions.py
Modified: branches/ivygen/ivy_functions.py
===================================================================
--- branches/ivygen/ivy_functions.py 2010-07-20 21:33:40 UTC (rev 822)
+++ branches/ivygen/ivy_functions.py 2010-07-20 21:34:48 UTC (rev 823)
@@ -111,8 +111,25 @@
####### obviously the middle i haven't figured out yet #########
'''
+ # code from kodemax
+ # determines shortest distance to a plane from a point
+ # still needs surrounding code
- pass
+ normal = mathutils.Vector((0,0,0))
+ plane_eq = mathutils.Vector((0,0,0,0))
+ minimum_dist = targetBoundingSphere[1] * max_adhesion_distance #set a maximum distance to minimum_distance
+ for fcs in obj.data.faces
+ N = fcs.normal #Normal to the face fcs
+ vert = bpy.context.object.data.verts[fcs.verts[0]]
+ point = vert.co #any point on the face
+ plane_eq = mathutils.Vector((N[0],N[1],N[2],-(N[0]*point[0]+N[1]*point[1]+N[2]*point[2]))) #Equation of the face
+ num = plane_eq[0]*old_pos[0]+plane_eq[1]*old_pos[1]+plane_eq[2]*old_pos[2]+plane_eq[3]
+ den = (pow(plane_eq[0],2))+(pow(plane_eq[1],2))+((plane_eq[2]^2))
+ den = pow(den,0.5)
+ dist = num/den #distance of the face from the old_point
+ if dist < minimum
+ minimum = dist
+
More information about the Bf-extensions-cvs
mailing list