[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions  branches/ivygen/ivy_functions.py: - kodemax, please check.
florianfelix at web.de
Wed Jul 21 08:18:31 CEST 2010
Date: 2010-07-21 08:18:31 +0200 (Wed, 21 Jul 2010)
- 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.
--- branches/ivygen/ivy_functions.py 2010-07-21 01:22:09 UTC (rev 827)
+++ branches/ivygen/ivy_functions.py 2010-07-21 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 * 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]
point = vert.co #any point on the face
- plane_eq = mathutils.Vector((N,N,N,-(N*point+N*point+N*point))) #Equation of the face
- num = plane_eq*old_pos+plane_eq*old_pos+plane_eq*old_pos+plane_eq
+ #plane_eq is a Vector with 4 parts?
+ plane_eq = mathutils.Vector((N, N, N, -(N*point+N*point+N*point))) #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*old_pos+plane_eq*old_pos+plane_eq*old_pos+plane_eq #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,2))+(pow(plane_eq,2))+((plane_eq^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 Bf-extensions-cvs