Beispiel #1
0
def random_direction():
    return normalize(Position.from_array(np.random.randn(2)))
Beispiel #2
0
def rotate(vec: Position, angle: float) -> Position:
    rotation = np.array([[np.cos(angle), -np.sin(angle)],
                         [np.sin(angle), np.cos(angle)]])
    return Position.from_array(rotation @ vec.array)