mercredi 28 avril 2021

measuring matrix distances within a python loop

i have the below code which draws circles on a matrix by changing points from 0s to 1s:

def renderCircle(Nx,Ny,radius): #function for drawing circles at x,y with radius r
  x = np.round(radius*x_circ+Nx).astype(int)
  y = np.round(radius*y_circ+Ny).astype(int)
  for i in range(len(x)):
   if x[i]>0 and x[i]<1024 and y[i]>0 and y[i]<1024: #ensuring plotted points are within the grid
    S[x[i], y[i]] = 1

i then loop this function over different start points (Nx and Ny) and over a list of radii (multiple circles are plotted from each start point. i need to add a section which will not plot the points from circle A if they are within any of the other circles - effectively an if statement which would say

if x[i] and y[i] are outside r[all other circles]: 
   S[x[i], y[i]] = 1

appreciate this may be a bit confusing but any help is hugely appreciated

Aucun commentaire:

Enregistrer un commentaire