Gram-Schmidt orthonormalization to generate orthonormal vectors from the linearly independent inputs. The function returns the smallest length of the unnormalized vectors computed during the process. If this value is nearly zero, it is possible that the inputs are linearly dependent (within numerical round-off errors).
| 48 | // this value is nearly zero, it is possible that the inputs are linearly |
| 49 | // dependent (within numerical round-off errors). |
| 50 | void orthonormalize( Basis3D& basis ) |
| 51 | { |
| 52 | for( const auto i : geode::LRange{ 3 } ) |
| 53 | { |
| 54 | for( const auto j : geode::LRange{ i } ) |
| 55 | { |
| 56 | const auto dot_ij = basis[i].dot( basis[j] ); |
| 57 | basis[i] -= basis[j] * dot_ij; |
| 58 | } |
| 59 | basis[i] = basis[i].normalize(); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // Compute a right-handed orthonormal basis for the orthogonal complement |
| 64 | // of the input vectors. The function returns the smallest length of the |
no test coverage detected