correct shared walls
This commit is contained in:
parent
0f8816a053
commit
86892332e3
|
@ -57,7 +57,7 @@ class GeometryHelper:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def factor():
|
def factor():
|
||||||
return 0.5
|
return 1
|
||||||
|
|
||||||
def __init__(self, delta=0, area_delta=0):
|
def __init__(self, delta=0, area_delta=0):
|
||||||
self._delta = delta
|
self._delta = delta
|
||||||
|
@ -84,7 +84,6 @@ class GeometryHelper:
|
||||||
factor = GeometryHelper.factor()
|
factor = GeometryHelper.factor()
|
||||||
x = math.ceil((city.upper_corner[0] - city.lower_corner[0]) * factor) + 1
|
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
|
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)]
|
city_map = [['' for _ in range(y + 1)] for _ in range(x + 1)]
|
||||||
map_info = [[{} 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
|
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)
|
distance = GeometryHelper.distance_between_points(coordinate, next_coordinate)
|
||||||
if distance == 0:
|
if distance == 0:
|
||||||
continue
|
continue
|
||||||
delta_x = (next_coordinate[0] - coordinate[0]) / (distance / factor)
|
delta_x = (next_coordinate[0] - coordinate[0]) / (distance * factor)
|
||||||
delta_y = (next_coordinate[1] - coordinate[1]) / (distance / factor)
|
delta_y = (next_coordinate[1] - coordinate[1]) / (distance * factor)
|
||||||
steps = int(distance/factor)
|
steps = int(distance * factor)
|
||||||
# print(steps, distance, delta_x, delta_y)
|
|
||||||
for k in range(0, steps):
|
for k in range(0, steps):
|
||||||
new_coordinate = (coordinate[0] + (delta_x * k), coordinate[1] + (delta_y * k))
|
new_coordinate = (coordinate[0] + (delta_x * k), coordinate[1] + (delta_y * k))
|
||||||
point = GeometryHelper.coordinate_to_map_point(new_coordinate, city)
|
point = GeometryHelper.coordinate_to_map_point(new_coordinate, city)
|
||||||
x = point.x
|
x = point.x
|
||||||
y = point.y
|
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] == '':
|
if city_map[x][y] == '':
|
||||||
city_map[x][y] = building.name
|
city_map[x][y] = building.name
|
||||||
map_info[x][y] = {
|
map_info[x][y] = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user