agentsociety.environment.utils.map_utils

Module Contents

Functions

get_angle

point_on_line_given_distance

Given two points (start_point and end_point) defining a line, and a distance s to travel along the line, return the coordinates of the point reached after traveling s units along the line, starting from start_point.

get_key_index_in_lane

get_xy_in_lane

get_direction_by_s

API

agentsociety.environment.utils.map_utils.get_angle(x, y)
agentsociety.environment.utils.map_utils.point_on_line_given_distance(start_node, end_node, distance)

Given two points (start_point and end_point) defining a line, and a distance s to travel along the line, return the coordinates of the point reached after traveling s units along the line, starting from start_point.

  • Args: start_point (tuple): tuple of (x, y) representing the starting point on the line. end_point (tuple): tuple of (x, y) representing the ending point on the line. distance (float): Distance to travel along the line, starting from start_point.

  • Returns: tuple: tuple of (x, y) representing the new point reached after traveling s units along the line.

agentsociety.environment.utils.map_utils.get_key_index_in_lane(nodes: list[dict[str, float]], distance: float, direction: Union[Literal[front], Literal[back]]) int
agentsociety.environment.utils.map_utils.get_xy_in_lane(nodes: list[dict[str, float]], distance: float, direction: Union[Literal[front], Literal[back]]) tuple[float, float]
agentsociety.environment.utils.map_utils.get_direction_by_s(nodes: list[dict[str, float]], distance: float, direction: Union[Literal[front], Literal[back]]) float