I think returning the zero vector in this case would be more natural than throwing an error. A vector with zero length is valid, it's just a special case to handle.

My point of view here is that

`UnitVector()` claims to return a vector of unit length. If it doesn't, that's a violation of the method's postcondition. Analoguously, a vector of length zero is

**not** a valid input -- you cannot compute the unit vector of a zero vector. Same thing if you compute the polar angle. In otherwords, the precondition is a non-zero vector argument, and Thor explicitly states that in the documentation.

I'm personally not a fan of hiding logic errors like this; if the user wants to handle zero vectors differently, he should do so explicitly. The nice side effect is that users who really want to compute a unit vector don't pay for a useless if statement.