Skip to content

Conversation

Raahi-18
Copy link

Fixed three bugs in math.py:

  1. Fixed rand_vec_spread_deg to convert degrees to radians before passing to Vec2.from_polar. Bug: rand_vec_spread_deg incorrectly passes degrees to Vec2.from_polar which requires radians #2648
  2. Fixed rotate_around_point to properly rotate around the source point instead of the target. Bug: rotate_around_point function in math.py returns incorrect results due to wrong translation #2753
  3. Corrected argument order in math.atan2 in get_angle_radians function, which previously caused incorrect angle calculations. Bug: get_angle_radians function in math.py returns incorrect angle due to swapped atan2 parameters #2754

…s argument order, fixed rotate_around_point offset, converted degrees to radians in rand_vec_spread_deg
Copy link
Collaborator

@DragonMoffon DragonMoffon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rand_vec_magnitude should also convert to radians, as arcade operates almost wholly on degrees, so this function expecting radians breaks convention

Also, it would be good to add unit tests for all of these functions. Preferably a unit test for every function in arcade.math, but that's out of the scope of this PR.

Having checked the arcade.math tests they are sorely lacking and can be fixed in a later PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants