To help me better understand the lambda, I wrote this short snippet that rotates and transforms the quad (I hope I got the math on the right). Now I want to replace the three steps below with a single liner, possibly in combination with map ().
Im using a vector class , but hopefully the functions are clear what they do.
self.orientation = vector(1,0)
self.orientation.rotate(90.0)
points = (vector(-1,-1),vector(1,-1),vector(1,1),vector(-1,1))
print points
rot_points = []
for i in points:
rot_points.append(i.rotated(self.orientation.get_angle()))
print rot_points
real_points = []
for i in rot_points:
real_points.append(self.pos+i*self.scale)
print real_points
return real_points
source
share