I want to generate a set of 16 (x,y) coordinates in a 4x4 square grid, such that for each (x,y) the nearest neighbour distance is 1.1m.
I have tried :
rad=1
rangeX=(0,4)
rangeY=(0,4)
randPts=[]
for i in range(0,15):
for j in range(i+1,qty):
x=random.randrange(*ranx)
y=random.randrange(*rany)
if (np.sqrt(((x[i]-x[j])**2)+((y[i]-y[j])**2)) != 1.1):
randPts.append((x,y))
This is giving me the error : TypeError: 'int' object has no attribute '__getitem__'
Can anyone kindly suggest how I can generate the required (x,y) grid?
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire