Open Doublestuf opened 1 month ago
Good point -- this adds the possibility of example_vector.normalize().is_normalized()
returning False, which could complicate things and essentially defeat the point of this change. I think this idea of making a new function called xnormalize
while leaving the current normalize
function would be more intuitive.
I'm not sure that it was actually determined for sure that this needs to be implemented in pygame-ce. I'm still partially against it because there are several nonintuitive things that could break if you expect normalizing to return a vector of magnitude 1
@oddbookworm Could you provide an example ? If we merge this, it will not break any code as the following structure :
if vector:
vector.normalize_ip()
Would still work. (which is what people are currently doing / supposed to do)
@Doublestuf So the test can pass, you'll have to update the test for normalize
, because it's currently expecting an error.
In issue #2269, it's been decided that pygame-ce should follow game engines such as Unity and Godot in allowing users to normalize zero-vectors for convenience.
Update the function in
math_test.c
, tests inmath_test.py
, and documentation inmath.rst
accordingly.