| 87 | } |
| 88 | |
| 89 | void Vector4::normalize() { |
| 90 | real_t lengthsq = length_squared(); |
| 91 | if (lengthsq == 0) { |
| 92 | x = y = z = w = 0; |
| 93 | } else { |
| 94 | real_t length = Math::sqrt(lengthsq); |
| 95 | x /= length; |
| 96 | y /= length; |
| 97 | z /= length; |
| 98 | w /= length; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | Vector4 Vector4::normalized() const { |
| 103 | Vector4 v = *this; |
no test coverage detected