I have the following Canvas class for drawing color in a given pixel:
class Canvas:
def __init__(self,color,pixel):
self.color = color
self.pixel = pixel
self.im = np.zeros((pixel,pixel,3))
self.im[:,:] = color
def show(self):
plt.imshow(self.im)
plt.axis("off")
This simple class draws a square with color, for example:
purple = np.array([0.5, 0.0, 0.5])
C = Canvas(purple, 2001) # 2001 x 2001 pixels
C.show()
I want to create add_disk() function with three argument: centroid,radius,color. So that
C.add_disk((1001, 1001), 500, white)
C.show()
However, I am not sure how to do it using the math formula:
I think I can use np.meshgrid to color white points, but how do I find those points and display on top of the square?



