This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static float const singularEps = 2 * 1.192092896e-7f; // float32 epsilon, *2 to have a bit of margin | |
// QR factorization using MGS | |
// store 1 / diag elements in diag of R since that's what we need | |
bool QR(IN(mat3,m),OUT(mat3,q),OUT(mat3,r)) { | |
q[0] = normalize(m[0]); | |
q[1] = normalize(m[1] - dot(m[1], q[0])*q[0]); | |
q[2] = cross(q[0], q[1]); | |
float d0 = dot(m[0], q[0]); |