mirror of
https://github.com/bevyengine/bevy
synced 2024-12-19 01:23:09 +00:00
488f64d700
# Objective The parameter names for `bevy::math::ops::atan2` are labelled such that `x` is the first argument and `y` is the second argument, but it passes those arguments directly to [`f32::atan2`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.atan2), whose parameters are expected to be `(y, x)`. This PR changes the parameter names in the bevy documentation to use the correct order for the operation being performed. You can verify this by doing: ```rust fn main() { let x = 3.0; let y = 4.0; let angle = bevy::math::ops::atan2(x, y); // standard polar coordinates formula dbg!(5.0 * angle.cos(), 5.0 * angle.sin()); } ``` This will print `(4.0, 3.0)`, which has flipped `x` and `y`. The problem is that the `atan2` function to calculate the angle was really expecting `(y, x)`, not `(x, y)`. ## Solution I flipped the parameter names for `bevy::math::ops::atan2` and updated the documentation. I also removed references to `self` and `other` from the documentation which seemed to be copied from the `f32::atan2` documentation. ## Testing Not really needed, you can compare the `f32::atan2` docs to the `bevy::math::ops::atan2` docs to see the problem is obvious. If a test is required I could add a short one. ## Migration Guide I'm not sure if this counts as a breaking change, since the implementation clearly meant to use `f32::atan2` directly, so it was really just the parameter names that were wrong. |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_color | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_dev_tools | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_ecs | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_image | ||
bevy_input | ||
bevy_input_focus | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mesh | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_picking | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_remote | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_state | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |