! Normalizes this vector. After this operation, the length of the vector is equal to 1. If the vector has both entries set to zero, this method does nothing. \see normalized, length, lengthSquared */
| 159 | \see normalized, length, lengthSquared |
| 160 | */ |
| 161 | void QCPVector2D::normalize() |
| 162 | { |
| 163 | if (mX == 0.0 && mY == 0.0) return; |
| 164 | const double lenInv = 1.0/length(); |
| 165 | mX *= lenInv; |
| 166 | mY *= lenInv; |
| 167 | } |
| 168 | |
| 169 | /*! |
| 170 | Returns a normalized version of this vector. The length of the returned vector is equal to 1. |
no test coverage detected