|
@ -334,21 +334,21 @@ class DailyPreprocessor(): |
|
|
# 교차로의 모든 (from / to) edges |
|
|
# 교차로의 모든 (from / to) edges |
|
|
inc_edges = [edge for edge in node.getIncoming() if edge.getFunction() == ''] # incoming edges |
|
|
inc_edges = [edge for edge in node.getIncoming() if edge.getFunction() == ''] # incoming edges |
|
|
out_edges = [edge for edge in node.getOutgoing() if edge.getFunction() == ''] # outgoing edges |
|
|
out_edges = [edge for edge in node.getOutgoing() if edge.getFunction() == ''] # outgoing edges |
|
|
# 교차로의 모든 (from / to) directions |
|
|
|
|
|
inc_dirs = [] |
|
|
|
|
|
|
|
|
# 교차로의 모든 (from / to) directions (unit vector) |
|
|
|
|
|
inc_vects = [] |
|
|
for inc_edge in inc_edges: |
|
|
for inc_edge in inc_edges: |
|
|
start = inc_edge.getShape()[-2] |
|
|
start = inc_edge.getShape()[-2] |
|
|
end = inc_edge.getShape()[-1] |
|
|
end = inc_edge.getShape()[-1] |
|
|
inc_dir = np.array(end) - np.array(start) |
|
|
|
|
|
inc_dir = inc_dir / (inc_dir ** 2).sum() ** 0.5 |
|
|
|
|
|
inc_dirs.append(inc_dir) |
|
|
|
|
|
out_dirs = [] |
|
|
|
|
|
|
|
|
inc_vect = np.array(end) - np.array(start) |
|
|
|
|
|
inc_vect = inc_vect / (inc_vect ** 2).sum() ** 0.5 |
|
|
|
|
|
inc_vects.append(inc_vect) |
|
|
|
|
|
out_vects = [] |
|
|
for out_edge in out_edges: |
|
|
for out_edge in out_edges: |
|
|
start = out_edge.getShape()[0] |
|
|
start = out_edge.getShape()[0] |
|
|
end = out_edge.getShape()[1] |
|
|
end = out_edge.getShape()[1] |
|
|
out_dir = np.array(end) - np.array(start) |
|
|
|
|
|
out_dir = out_dir / (out_dir ** 2).sum() ** 0.5 |
|
|
|
|
|
out_dirs.append(out_dir) |
|
|
|
|
|
|
|
|
out_vect = np.array(end) - np.array(start) |
|
|
|
|
|
out_vect = out_vect / (out_vect ** 2).sum() ** 0.5 |
|
|
|
|
|
out_vects.append(out_vect) |
|
|
# 진입각, 진출각 불러오기 |
|
|
# 진입각, 진출각 불러오기 |
|
|
if not pd.isna(row.inc_angle): |
|
|
if not pd.isna(row.inc_angle): |
|
|
inc_angle = int(row.inc_angle) |
|
|
inc_angle = int(row.inc_angle) |
|
@ -356,13 +356,13 @@ class DailyPreprocessor(): |
|
|
# 방위각을 일반각으로 가공, 라디안 변환, 단위벡터로 변환 |
|
|
# 방위각을 일반각으로 가공, 라디안 변환, 단위벡터로 변환 |
|
|
inc_angle = (-90 - inc_angle) % 360 |
|
|
inc_angle = (-90 - inc_angle) % 360 |
|
|
inc_angle = inc_angle * np.pi / 180. |
|
|
inc_angle = inc_angle * np.pi / 180. |
|
|
inc_dir_true = np.array([np.cos(inc_angle), np.sin(inc_angle)]) |
|
|
|
|
|
|
|
|
inc_vect_true = np.array([np.cos(inc_angle), np.sin(inc_angle)]) |
|
|
out_angle = (90 - out_angle) % 360 |
|
|
out_angle = (90 - out_angle) % 360 |
|
|
out_angle = out_angle * np.pi / 180. |
|
|
out_angle = out_angle * np.pi / 180. |
|
|
out_dir_true = np.array([np.cos(out_angle), np.sin(out_angle)]) |
|
|
|
|
|
|
|
|
out_vect_true = np.array([np.cos(out_angle), np.sin(out_angle)]) |
|
|
# 매칭 엣지 반환 |
|
|
# 매칭 엣지 반환 |
|
|
inc_index = np.array([np.dot(inc_dir, inc_dir_true) for inc_dir in inc_dirs]).argmax() |
|
|
|
|
|
out_index = np.array([np.dot(out_dir, out_dir_true) for out_dir in out_dirs]).argmax() |
|
|
|
|
|
|
|
|
inc_index = np.array([np.dot(inc_vect, inc_vect_true) for inc_vect in inc_vects]).argmax() |
|
|
|
|
|
out_index = np.array([np.dot(out_vect, out_vect_true) for out_vect in out_vects]).argmax() |
|
|
inc_edge_id = inc_edges[inc_index].getID() |
|
|
inc_edge_id = inc_edges[inc_index].getID() |
|
|
out_edge_id = out_edges[out_index].getID() |
|
|
out_edge_id = out_edges[out_index].getID() |
|
|
self.match5.at[index, 'inc_edge'] = inc_edge_id |
|
|
self.match5.at[index, 'inc_edge'] = inc_edge_id |
|
|