toji/gl-matrix

quat.setAxes initialize a mat3 in a (probably) wrong way

Opened this issue · 1 comments

I was looking at the code for the method setAxes (https://glmatrix.net/docs/quat.js.html#line716) and it initialize the mat3 as if the axes are not specified all together (so right would be the first 3 numbers of the matrix).
Seeing how mat4 handles them, it seems to me that right is made by [0] [1] and [2], and not [0] [3] and [6]

I'm not sure of this of course, but otherwise the way mat4 is handled is weird, having instead the translation in the last 4 digits

Hello, i had same issue, i can't understand why my oriention is always wrong, i tried different orders for my vectors in hope to find the correct orientation for given vectors but i never found a way. I hope someone will make it clear.

I found another way to do same but without setAxes. From local to global = from no orientation to new orientation : we can use vectors without "substracting" previous orientation (since it's identity rotation) :

const matrix = mat3.fromValues(...xAxisNormalized, ...axisProximalToDistalNormalized, ...axisNormalNormalized); const newOrientation = quat.create(); quat.fromMat3(newOrientation, matrix);