swarm_sim_header.py 909 Bytes
Newer Older
1
def get_coordinates_in_direction(coordinates, direction):
2
3
4
    """
    Returns the coordination data of the pointed directions

5
    :param coordinates: particles actual staying coordination
6
7
8
    :param direction: The direction. Options:  E, SE, SW, W, NW, or NE
    :return: The coordinaiton of the pointed directions
    """
Karol Actun's avatar
Karol Actun committed
9
    return coordinates[0] + direction[0], coordinates[1] + direction[1], coordinates[2] + direction[2]
10
11


Karol Actun's avatar
Karol Actun committed
12
13
14
15
16
17
18
def scan_in(matter_map: dict, center, hop, grid):
    result = []
    n_sphere_border = grid.get_n_sphere_border(center, hop)
    for l in n_sphere_border:
        if l in matter_map:
            result.append(matter_map[l])
    return result
19
20


Karol Actun's avatar
Karol Actun committed
21
22
23
24
25
26
27
def scan_within(matter_map, center, hop, grid):
    result = []
    n_sphere_border = grid.get_n_sphere(center, hop)
    for l in n_sphere_border:
        if l in matter_map:
            result.append(matter_map[l])
    return result
28