correct shared walls

This commit is contained in:
Guille Gutierrez 2023-04-21 12:56:32 -04:00
parent 0f8816a053
commit 86892332e3

View File

@ -57,7 +57,7 @@ class GeometryHelper:
@staticmethod
def factor():
return 0.5
return 1
def __init__(self, delta=0, area_delta=0):
self._delta = delta
@ -84,7 +84,6 @@ class GeometryHelper:
factor = GeometryHelper.factor()
x = math.ceil((city.upper_corner[0] - city.lower_corner[0]) * factor) + 1
y = math.ceil((city.upper_corner[1] - city.lower_corner[1]) * factor) + 1
# print(x, y)
city_map = [['' for _ in range(y + 1)] for _ in range(x + 1)]
map_info = [[{} for _ in range(y + 1)] for _ in range(x + 1)]
img = Image.new('RGB', (x + 1, y + 1), "black") # create a new black image
@ -103,16 +102,14 @@ class GeometryHelper:
distance = GeometryHelper.distance_between_points(coordinate, next_coordinate)
if distance == 0:
continue
delta_x = (next_coordinate[0] - coordinate[0]) / (distance / factor)
delta_y = (next_coordinate[1] - coordinate[1]) / (distance / factor)
steps = int(distance/factor)
# print(steps, distance, delta_x, delta_y)
delta_x = (next_coordinate[0] - coordinate[0]) / (distance * factor)
delta_y = (next_coordinate[1] - coordinate[1]) / (distance * factor)
steps = int(distance * factor)
for k in range(0, steps):
new_coordinate = (coordinate[0] + (delta_x * k), coordinate[1] + (delta_y * k))
point = GeometryHelper.coordinate_to_map_point(new_coordinate, city)
x = point.x
y = point.y
# print(x, y, new_coordinate[0]-city.lower_corner[0], new_coordinate[1]-city.lower_corner[1])
if city_map[x][y] == '':
city_map[x][y] = building.name
map_info[x][y] = {