Skip to content

Commit 35a2aaa

Browse files
committed
fix: ElasticBands test
1 parent 51eab04 commit 35a2aaa

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/test_elastic_bands.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@
44

55

66
def test_1():
7-
path = np.load("PathPlanning/ElasticBands/points.npy")
8-
obstacles = np.load("PathPlanning/ElasticBands/obstacles.npy")
7+
path = np.load("PathPlanning/ElasticBands/path.npy")
8+
obstacles_points = np.load("PathPlanning/ElasticBands/obstacles.npy")
9+
obstacles = np.zeros((500, 500))
10+
for x, y in obstacles_points:
11+
size = 30 # Side length of the square
12+
half_size = size // 2
13+
x_start = max(0, x - half_size)
14+
x_end = min(obstacles.shape[0], x + half_size)
15+
y_start = max(0, y - half_size)
16+
y_end = min(obstacles.shape[1], y + half_size)
17+
obstacles[x_start:x_end, y_start:y_end] = 1
918
elastic_bands = ElasticBands(path, obstacles)
1019
elastic_bands.update_bubbles()
1120

0 commit comments

Comments
 (0)