On Sat, Mar 6, 2010 at 12:03 PM, Friedrich Romstedt <span dir="ltr"><<a href="mailto:friedrichromstedt@gmail.com">friedrichromstedt@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
At the moment, I can do nothing about that. Seems that we have<br>
reached the limit. Anyhow, is it now faster than your Python list<br>
implementation, and if yes, how much? How large was your gain by<br>
using numpy means at all? I'm just curious.<br></blockquote><div>Unfortunately, the pure Python implementation is actually an order of magnitude faster. The fastest solution right now is to use numpy for the transformations, then convert it back into a list (.tolist()) and use Python for the rest.<br>
<br>Here's the actual Python code.<br><br>def glLibInternal_edges(object,lightpos):<br> edge_set = set([])<br> edges = {}<br> for sublist in xrange(object.number_of_lists): #There's only one sublist here<br>
face_data = object.light_volume_face_data[sublist]<br> for indices in face_data: #v1,v2,v3,n<br> normal = object.transformed_normals[sublist][indices[3]]<br> v1,v2,v3 = [ object.transformed_vertices[sublist][indices[i]] for i in xrange(3) ]<br>
if abs_angle_between_rad(normal,vec_subt(v1,lightpos))<pi_over_two:<br> for p1,p2 in [[indices[0],indices[1]],<br> [indices[1],indices[2]],<br> [indices[2],indices[0]]]:<br>
edge = [p1,p2]<br> index = 0<br> edge2 = list(edge)<br> edge2.sort()<br> edge2 = tuple(edge2)<br> if edge2 in edges: edges[edge2][1] += 1<br>
else: edges[edge2] = [edge,1]<br> edges2 = []<br> for edge_data in edges.values():<br> if edge_data[1] == 1:<br> p1 = object.transformed_vertices[sublist][edge_data[0][0]]<br>
p2 = object.transformed_vertices[sublist][edge_data[0][1]]<br> edges2.append([p1,p2])<br> return edges2<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">Friedrich<br></div></div></blockquote><div>Thanks, <br></div><div>Ian <br></div></div>