bitshifter / glam-rs

A simple and fast linear algebra library for games and graphics
Apache License 2.0
1.46k stars 145 forks source link

fix(f32): is_normalized #532

Closed 5-23 closed 3 weeks ago

5-23 commented 1 month ago

Error correction of this way

image
bitshifter commented 1 month ago

Can you please provide a text description for this and update the tests to include the problem you are fixing

5-23 commented 1 month ago

Can you please provide a text description for this and update the tests to include the problem you are fixing

This code eliminates the error that occurs when the length of vec2 is smaller than the minimum value of f32.

5-23 commented 1 month ago

While playing with bevy_xpbd, an error occurred, so I searched for it and estimated the cause.

bitshifter commented 1 month ago

it would help if you can provide a working repro, in text, not an image. so by that I mean a vec2 which is normalized but fails the current is_normalized check

bitshifter commented 1 month ago

I don't really think this change makes sense, at least it is inefficient because the code now calculates length_squared twice, adds an if statement and it makes the check potentially too narrow, but I would like to better understand the problem you are trying to fix.

bitshifter commented 3 weeks ago

Closing this, if you can provide some example code showing how is_normalized is doing something unexpected please open an issue.