+ for y in xrange(size[1]):
+ if image_l[x, y]:
+ # for every angle:
+ for a in xrange(size[1]):
+ # find the distance:
+ # distance is the dot product of vector (x, y) - centerpoint
+ # and a unit vector orthogonal to the angle
+ distance = (((x - (size[0] / 2)) * sin((dt * a) + initial_angle)) +
+ ((y - (size[1] / 2)) * -cos((dt * a) + initial_angle)) +
+ size[0] / 2)
+ # column of the matrix closest to the distance
+ column = int(round(distance))
+ if column >= 0 and column < size[0]:
+ matrix[column][a] += 1
+
+ new_image = Image.new('L', size)
+ new_image_l = new_image.load()
+
+ minimum = min([min(m) for m in matrix])
+
+ maximum = max([max(m) for m in matrix]) - minimum
+
+ for y in xrange(size[1]):
+ for x in xrange(size[0]):
+ new_image_l[x, y] = (float(matrix[x][y] - minimum) / maximum) * 255