Skip to content

Quat.fromMat4() bug #38

@byouloh

Description

@byouloh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions