Misc Utility Functions#

arcade.configure_logging#

arcade.configure_logging(level: Optional[int] = None)[source]#

Set up basic logging. :param int level: The log level. Defaults to DEBUG.

arcade.generate_uuid_from_kwargs#

arcade.generate_uuid_from_kwargs(**kwargs) str[source]#

Given key/pair combos, returns a string in uuid format. Such as text=’hi’, size=32 it will return “text-hi-size-32”. Called with no parameters, id does NOT return a random unique id.

arcade.lerp#

arcade.lerp(v1: float, v2: float, u: float) float[source]#

linearly interpolate between two values

arcade.lerp_angle#

arcade.lerp_angle(start_angle: float, end_angle: float, u: float)[source]#

Linearly interpolate between two angles in degrees, following the shortest path.

arcade.lerp_vec#

arcade.lerp_vec(v1: Tuple[float, float], v2: Tuple[float, float], u: float) Tuple[float, float][source]#

arcade.rand_angle_360_deg#

arcade.rand_angle_360_deg()[source]#

Return a random angle in degrees.

arcade.rand_angle_spread_deg#

arcade.rand_angle_spread_deg(angle: float, half_angle_spread: float) float[source]#

arcade.rand_in_circle#

arcade.rand_in_circle(center: Tuple[float, float], radius: float)[source]#

Generate a point in a circle, or can think of it as a vector pointing a random direction with a random magnitude <= radius Reference: https://stackoverflow.com/a/30564123 Note: This algorithm returns a higher concentration of points around the center of the circle

arcade.rand_in_rect#

arcade.rand_in_rect(bottom_left: Tuple[float, float], width: float, height: float) Tuple[float, float][source]#

arcade.rand_on_circle#

arcade.rand_on_circle(center: Tuple[float, float], radius: float) Tuple[float, float][source]#

Note: by passing a random value in for float, you can achieve what rand_in_circle() does

arcade.rand_on_line#

arcade.rand_on_line(pos1: Tuple[float, float], pos2: Tuple[float, float]) Tuple[float, float][source]#

Given two points defining a line, return a random point on that line.

arcade.rand_vec_magnitude#

arcade.rand_vec_magnitude(angle: float, lo_magnitude: float, hi_magnitude: float) Tuple[float, float][source]#

arcade.rand_vec_spread_deg#

arcade.rand_vec_spread_deg(angle: float, half_angle_spread: float, length: float) Tuple[float, float][source]#