You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The rand_vec_spread_deg function in the Python Arcade library's math module (arcade/math.py) has a bug where it passes angles in degrees to Vec2.from_polar(), which expects angles in radians.
Current, incorrect implementation:
def rand_vec_spread_deg(angle: float, half_angle_spread: float, length: float) -> Point2:
a = rand_angle_spread_deg(angle, half_angle_spread)
vel = Vec2.from_polar(a, length) # Bug: 'a' is in degrees but from_polar expects radians
return vel.x, vel.y
Vec2.from_polar's source code:
@staticmethod
def from_polar(angle: float, length: float = 1.0) -> Vec2:
"""Create a new vector from the given polar coordinates.
Args:
angle: The angle, in radians. # <-- Expects radians
length: The desired length
"""
return Vec2(length * _math.cos(angle), length * _math.sin(angle))