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

Matrix3.rotationY provides incorrect matrix #261

Closed
bluebaloon opened this issue Mar 12, 2022 · 2 comments
Closed

Matrix3.rotationY provides incorrect matrix #261

bluebaloon opened this issue Mar 12, 2022 · 2 comments

Comments

@bluebaloon
Copy link

For pi/2 it gives result of
[0 0 -1]
[0 1 0]
[1 0 0]
which is incorrect.
It should be
[0 0 1]
[0 1 0]
[-1 0 0]
Rows are written in place of columns (like transpose).
Code should be corrected as given below.
/// Turns the matrix into a rotation of [radians] around Y
void setRotationY(double radians) {
final c = math.cos(radians);
final s = math.sin(radians);
_m3storage[0] = c;
_m3storage[1] = 0.0;
_m3storage[2] = -s;
_m3storage[3] = 0.0;
_m3storage[4] = 1.0;
_m3storage[5] = 0.0;
_m3storage[6] = s;
_m3storage[7] = 0.0;
_m3storage[8] = c;
}

Please check.

@GhostCore07
Copy link

Related to #69.
Looks like a bug.

@moritzblume
Copy link
Contributor

I just stumbled over this bug, too. As it is implemented, the rotation would be clockwise which does not fit the norm (right-hand-rule) and is inconsistent with setRotationX and setRotationZ.

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

4 participants