[Bf-python] face.edges ?

Gert De Roost paleajed at yahoo.com
Fri Mar 18 17:19:30 CET 2005


In my KnifePro script I make a dictionary of all edges
as keys and associated faces and vertice screen
coordinates.

Code:

for face in mesh.faces:
	for posn in range(-1, len(face.v) - 1):
		edge = mesh.findEdge(face.v[posn], face.v[posn + 1])
		if edged.has_key(edge):
			edged[edge][0] += [face]
		else:
			# vertd = dictionary with vert screen coordinates
			edged[edge] = [[face], [vertd[edge.v1],
vertd[edge.v2]]]


When the total face count is 2000 this is rather slow
already:
total time: 1.2 seconds
These 1.2 seconds are almost entirely used by the line
containing the mesh.findEdge statement.

The speed of findEdge seems to go down very fast when 
the total mesh gets bigger: when this is 8000, total
time is 28.6 seconds!  Again, almost entirely used by
the line containing the mesh.findEdge statement.


I am sure Blender keeps track internally of which
edges are associated with each face, this is why I
would propose adding a "face.edges" variable, this
would make my script usable for all mesh sizes.  As it
is now, I am kind of reluctant developing it further.


.gert.



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 



More information about the Bf-python mailing list