returns squared length (norm)
| 1016 | |
| 1017 | // returns squared length (norm) |
| 1018 | inline double normalize(const vec* pDefaultVec = NULL) |
| 1019 | { |
| 1020 | double n = m_s[0] * m_s[0]; |
| 1021 | for (uint32_t i = 1; i < N; i++) |
| 1022 | n += m_s[i] * m_s[i]; |
| 1023 | |
| 1024 | if (n != 0) |
| 1025 | *this *= static_cast<T>(1.0f / sqrt(n)); |
| 1026 | else if (pDefaultVec) |
| 1027 | *this = *pDefaultVec; |
| 1028 | return n; |
| 1029 | } |
| 1030 | |
| 1031 | inline double normalize3(const vec* pDefaultVec = NULL) |
| 1032 | { |