def random_direction(): return normalize(Position.from_array(np.random.randn(2)))
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)