fallahn / xygine

2D engine / framework built around SFML
218 stars 19 forks source link

xy::Util::Vector::normalise fails assertion on 0 length vectors #99

Closed JonnyPtn closed 6 years ago

JonnyPtn commented 6 years ago

calling xy::Util::Vector::normalise(vec) where vec is 0,0 causes an assert to fail. I'd expect it to just return 0,0?

Not a major issue, as I can adjust my code to handle these special cases, just seems like it would add some convenience without any downsides?

fallahn commented 6 years ago

Originally I believe I returned a zero vector, but changed the behaviour based on a post on the sfml forum - possibly this one which seemed to make more sense to me, ie the fact that you're trying to normalise a zero vector implies a logic error.

JonnyPtn commented 6 years ago

Seems reasonable, the length should always be 1. Thanks!