@{ * Normalize the vector in place. * \return The length of the vector. */
| 72 | * \return The length of the vector. |
| 73 | */ |
| 74 | double Normalize() |
| 75 | { |
| 76 | const double norm(this->Norm()); |
| 77 | if (norm == 0.0) |
| 78 | { |
| 79 | return 0.0; |
| 80 | } |
| 81 | const double inv(1.0 / norm); |
| 82 | for (int i = 0; i < Size; ++i) |
| 83 | { |
| 84 | this->Data[i] = static_cast<T>(this->Data[i] * inv); |
| 85 | } |
| 86 | return norm; |
| 87 | } |
| 88 | ///@} |
| 89 | |
| 90 | ///@{ |