nannou-org / nannou

A Creative Coding Framework for Rust.
https://nannou.cc/
6.05k stars 307 forks source link

Fix nature_of_code/chp_01_vectors example #885

Closed chooblarin closed 10 months ago

chooblarin commented 2 years ago

When the distance vector between the mouse coordinates and Mover is zero, the calculation results in NaN as it tries to normalize() it. (Blank screen is displayed.)

I found normalize_or_zero() in the docs and this would be great alternative for the case.

tpltnt commented 1 year ago

Looks good to me and should be merged soon.