What would be the fastest way to do something like this without the loops?
The piece of code creates a line with separate value on each side of the line.
def get_image(img_size = (500,500),angle=90) :
angle = angle*np.pi/180
img = np.zeros(img_size)
center = np.array(img_size)/2
for x in range(img_size[0]):
for y in range(img_size[1]):
cord = np.array((x,y))
true_cord = cord - center
x1,y1 = true_cord
if y1 > np.tan(angle)*x1 :
img[x,y] = 1
return img
