Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quat.fromMat4() bug #38

Open
byouloh opened this issue Mar 14, 2013 · 0 comments
Open

Quat.fromMat4() bug #38

byouloh opened this issue Mar 14, 2013 · 0 comments

Comments

@byouloh
Copy link

byouloh commented Mar 14, 2013

Hi developers,

Your definition for Mat4 is (n11, n12, n13, n14, ..., n44).
But, Quat.fromMat4 is written as follows:
...
u, v, and w is one of 0, 1, 2.
...
q[v] = 0.5 * (m['n' + v + '' + u] + m['n' + u + '' + v]) / r;
q[w] = 0.5 * (m['n' + u + '' + w] + m['n' + w + '' + u]) / r;
q[3] = 0.5 * (m['n' + v + '' + w] - m['n' + w + '' + v]) / r;
...

So, it makes a bug, undefined.
for example, if when v=0 and u=1, 'n' + v + '' + u makes "n01" and m["n01"] is undefined.

q[v] = 0.5 * (m['n' + (v + 1) + '' + (u + 1)] + m['n' + (u + 1) + '' + (v + 1)]) / r;
q[w] = 0.5 * (m['n' + (u + 1) + '' + (w + 1)] + m['n' + (w + 1) + '' + (u + 1)]) / r;
q[3] = 0.5 * (m['n' + (v + 1) + '' + (w + 1)] - m['n' + (w + 1) + '' + (v + 1)]) / r;

maybe right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant