You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have put together the following example to demonstrate a problem with Rotate method on f32.Mat4. I attempt to rotate a vector v (edit: vector u) around the X axis. The resulting vector does not have the same length (in this extreme case the "rotation" has collapsed a unit vector to zero-length).
When I actually use the resulting transformation in OpenGL what I have observed is that my models gets flattened onto a plane (presumably the Y-Z plane, perpendicular to the X axis, at X=0).
I believe the problem lies in how the first row of the rotation matrix is constructed.
I kind of suck at this stuff. But you can see the subsequent rows in the matrix have a pattern which is not observed in the first row. So I tried changing the first row of the rotation matrix to the following.
I have put together the following example to demonstrate a problem with Rotate method on f32.Mat4. I attempt to rotate a
vector v(edit: vector u) around the X axis. The resulting vector does not have the same length (in this extreme case the "rotation" has collapsed a unit vector to zero-length).http://play.golang.org/p/INyRQCldPm
When I actually use the resulting transformation in OpenGL what I have observed is that my models gets flattened onto a plane (presumably the Y-Z plane, perpendicular to the X axis, at X=0).
I believe the problem lies in how the first row of the rotation matrix is constructed.
https://github.com/golang/mobile/blob/467d8559f22b81884dfbc37d1cef95d0fab78049/exp/f32/mat4.go#L157-L160
I kind of suck at this stuff. But you can see the subsequent rows in the matrix have a pattern which is not observed in the first row. So I tried changing the first row of the rotation matrix to the following.
And that looks like it works.
The following demonstrates the altered Rotate function: http://play.golang.org/p/8ZrOpdv_AY
This second example confirms rotation of [1, 0, 0] around the X axis yields [1, 0, 0]. Obviously length was preserved.
The text was updated successfully, but these errors were encountered: