bevy/crates/bevy_math/src
Greeble 71b22397da
Expand EasingCurve documentation (#17778)
# Objective

- Expand the documentation for `EasingCurve`.
- I suspect this might have avoided the confusion in
https://github.com/bevyengine/bevy/pull/17711.
- Also add a shortcut for simple cases.

## Solution

- Added various examples and extra context.
- Implemented `Curve<T>` for `EaseFunction`.
- This means `EasingCurve::new(0.0, 1.0, EaseFunction::X)` can be
shortened to `EaseFunction::X`.
    - In some cases this will be a minor performance improvement.
    - Added test to confirm they're the same.
- ~~Added some benchmarks for bonus points.~~


## Side Notes

- I would have liked to rename `EaseFunction` to `EaseFn` for brevity,
but that would be a breaking change and maybe controversial.
    - Also suspect `EasingCurve` should be `EaseCurve`, but say la vee.
- Benchmarks show that calling `EaseFunction::Smoothstep` is still
slower than calling `smoothstep` directly.
- I think this is because the compiler refuses to inline
`EaseFunction::eval`.
- I don't see any good solution - might need a whole different
interface.

## Testing

```sh
cargo test --package bevy_math

cargo doc --package bevy_math
./target/doc/bevy_math/curve/easing/struct.EasingCurve.html

cargo bench --package benches --bench math -- easing
```
2025-02-10 22:37:27 +00:00
..
bounding Reworked Segment types into their cartesian forms (#17404) 2025-01-19 03:54:45 +00:00
cubic_splines Remove Implicit std Prelude from no_std Crates (#17086) 2025-01-03 01:58:43 +00:00
curve Expand EasingCurve documentation (#17778) 2025-02-10 22:37:27 +00:00
primitives Reworked Segment types into their cartesian forms (#17404) 2025-01-19 03:54:45 +00:00
rects Add no_std Support to bevy_math (#15810) 2024-12-03 17:14:51 +00:00
sampling Prefer Display over Debug (#16112) 2024-12-27 00:40:06 +00:00
affine3.rs Implemented Reflect for (almost) all bevy_math types (#13537) 2024-05-27 18:18:10 +00:00
aspect_ratio.rs Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
common_traits.rs Use variadics_please to implement StableInterpolate on tuples. (#16931) 2024-12-24 02:53:43 +00:00
compass.rs Add basic directional (gamepad) navigation for UI (and non-UI) (#17102) 2025-01-06 18:51:44 +00:00
direction.rs make bevy math publishable (#17727) 2025-02-10 22:15:53 +00:00
float_ord.rs bevy_math: Apply #[deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] (#17091) 2025-01-02 18:47:36 +00:00
isometry.rs make bevy math publishable (#17727) 2025-02-10 22:15:53 +00:00
lib.rs Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
ops.rs bevy_math: Apply #[deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] (#17091) 2025-01-02 18:47:36 +00:00
ray.rs Add no_std Support to bevy_math (#15810) 2024-12-03 17:14:51 +00:00
rotation2d.rs make bevy math publishable (#17727) 2025-02-10 22:15:53 +00:00