def process_neighborhoods(west, south, rows, columns, ax, size, nodes, draw=False): hexes, centers, corners = tile_hex((west - 0.006, south + 0.002), rows, columns, ax, size, 'b', nodes, draw=draw) print(len(nodes), len(hexes)) # print(hex_dict.keys()) neighborhoods = [] for i in range(len(hexes)): current_center = centers[i] current_corners = corners[i] exits, distances = find_exits(hexes[i], current_corners, current_center, size) # print(exits) # print(len(hexes[i]),len(exits)) nh = Neighborhood() nh.setNodes(hexes[i]) nh.setCorners(current_corners) nh.setCenter(current_center) nh.setExits(exits) nh.setDistances(distances) if exits == None: nh = None neighborhoods.append(nh) if exits == None: continue # if draw: # for n in exits: # ax.scatter(n.x,n.y,s=50,c='b') hex_dict = find_neighbors(neighborhoods, columns) for i in range(len(neighborhoods)): if neighborhoods[i] != None: neighborhoods[i].setNeighbors(hex_dict[i]) neighborhoods[i].setID(i) return neighborhoods