[Bfextensionscvs] SVN commit: /data/svn/bfextensions [828] branches/ivygen/ivy_functions.py:  kodemax, please check.
Florian Meyer
florianfelix at web.de
Wed Jul 21 08:18:31 CEST 2010
Revision: 828
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bfextensions&revision=828
Author: testscreenings
Date: 20100721 08:18:31 +0200 (Wed, 21 Jul 2010)
Log Message:

 kodemax, please check. i have added many comments and more questions.
 it would also be nice if you could outline the whole function even if it is nonoperational. just to see how this fits into the whole.
Modified Paths:

branches/ivygen/ivy_functions.py
Modified: branches/ivygen/ivy_functions.py
===================================================================
 branches/ivygen/ivy_functions.py 20100721 01:22:09 UTC (rev 827)
+++ branches/ivygen/ivy_functions.py 20100721 06:18:31 UTC (rev 828)
@@ 115,21 +115,40 @@
# determines shortest distance to a plane from a point
# still needs surrounding code
 normal = mathutils.Vector((0,0,0))
 plane_eq = mathutils.Vector((0,0,0,0))
+ #
+
+ face_index = 0 # don't need this, i think (or maybe you have a plan)
+ normal = mathutils.Vector((0,0,0)) # same here?
+ plane_eq = mathutils.Vector((0,0,0,0)) # why 4 # and here
+
minimum_dist = targetBoundingSphere[1] * max_adhesion_distance #set a maximum distance to minimum_distance
 for fcs in obj.data.faces:
+ for i, fcs in enumerate(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]
+
+ #plane_eq is a Vector with 4 parts?
+ 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
+ # part1 part2 part3 part4____________________________________ #the 4 parts
+ # fca.normal.dot(vert.co) #simpler 4th part
+ # i must confess i havn't compared this yet to the page you sent, but i think this doesn't make much sense.
+ # although if it does i am more than happy to be told otherwise :)
+ # what does this vector represent?
+
+ num = plane_eq[0]*old_pos[0]+plane_eq[1]*old_pos[1]+plane_eq[2]*old_pos[2]+plane_eq[3] #this yields a float
+ # num = plane_eq.dot(old_pos.resize4D())
+ # this should yield the same
+ # what does this represent? the distance from old_pos to the plane?
+
den = (pow(plane_eq[0],2))+(pow(plane_eq[1],2))+((plane_eq[2]^2))
+ # what's this ^ symbol for, never seen/used it
+ #what does this represent?
+
den = pow(den,0.5)
dist = num/den #distance of the face from the old_point
 if dist < minimum:
+ if dist < minimum: # variable not defined before. you mean minimum_dist?
minimum = dist

+ face_index = i # added this befor, don't know why, sorry for the confusion.
More information about the Bfextensionscvs
mailing list