bevy/crates
Daniel Beckwith c928ca1e18 Fix atan2 docs (#16673)
# 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.
2025-01-03 19:15:53 +01:00
..
bevy_a11y Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_animation Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_app Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_asset Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_audio Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_color Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_core Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_core_pipeline Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_derive Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_dev_tools Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_diagnostic Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_dylib Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_ecs Expose SystemMeta's access field as part of public API (#16625) 2025-01-03 19:15:53 +01:00
bevy_encase_derive Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_gilrs Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_gizmos Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_gltf Make bevy_gltf compile without bevy_animation feature (#16551) 2025-01-03 19:15:53 +01:00
bevy_hierarchy Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_image Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_input Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_internal Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_log Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_macro_utils Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_math Fix atan2 docs (#16673) 2025-01-03 19:15:53 +01:00
bevy_mesh Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_mikktspace Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_pbr Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_picking picking: disable raycast backface culling for Mesh2d (#16657) 2025-01-03 19:15:53 +01:00
bevy_ptr Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_reflect Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_remote BrpQueryRow has field deserialization fix (#16613) 2025-01-03 19:15:53 +01:00
bevy_render Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_scene Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_sprite Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_state Make StateTransitionSteps public (#16612) 2025-01-03 19:15:53 +01:00
bevy_tasks Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_text Add missing registration for TextEntity (#16649) 2025-01-03 19:15:53 +01:00
bevy_time Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_transform Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_ui Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_utils Release 0.15.0 2024-11-29 01:50:42 +01:00
bevy_window add missing type registration for Monitor (#16685) 2025-01-03 19:15:53 +01:00
bevy_winit Release 0.15.0 2024-11-29 01:50:42 +01:00