Skip to content

Conversation

@Jondolf
Copy link
Contributor

@Jondolf Jondolf commented Feb 1, 2024

Objective

approx has traits like AbsDiffEq, RelativeEq, and UlpsEq. Glam implements them for its math types when the approx feature is enabled. Bevy's Direction2d and Direction3d should implement these too.

Solution

Implement the traits. See how Glam implements them for its own math types. For the epsilon values, I use the same as Vec2/Vec3 (just f32::EPSILON).

@Jondolf Jondolf added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Math Fundamental domain-agnostic mathematical operations labels Feb 1, 2024
@tim-blackbird tim-blackbird added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Feb 1, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Feb 1, 2024
Merged via the queue into bevyengine:main with commit d30fdda Feb 1, 2024
@Jondolf Jondolf deleted the approx-direction branch February 1, 2024 19:50
tjamaan pushed a commit to tjamaan/bevy that referenced this pull request Feb 6, 2024
# Objective

`approx` has traits like
[`AbsDiffEq`](https://docs.rs/approx/latest/approx/trait.AbsDiffEq.html),
[`RelativeEq`](https://docs.rs/approx/latest/approx/trait.RelativeEq.html),
and [`UlpsEq`](https://docs.rs/approx/latest/approx/trait.UlpsEq.html).
Glam implements them for its math types when the `approx` feature is
enabled. Bevy's `Direction2d` and `Direction3d` should implement these
too.

## Solution

Implement the traits. See [how Glam implements them for its own math
types](https://github.com/bitshifter/glam-rs/blob/main/src/features/impl_approx.rs).
For the epsilon values, I use the same as `Vec2`/`Vec3` (just
`f32::EPSILON`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Math Fundamental domain-agnostic mathematical operations C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants