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
Problem with Rotate instruction with x and y axis. #5825
Comments
A little edit I would like to make to the code above:
So that I ensure the z of point of origin is set to 0, the screen surface. It makes no changes anyway. |
I think you want to read up on the OpenGL Projection matrix (for example http://www.songho.ca/opengl/gl_projectionmatrix.html), kivy being essentially 2D oriented, doesn't need one with much depth, kivy/kivy/core/window/__init__.py Line 1438 in b173ec6
On the other hand the 3DRendering example sets a different one to be able to do more. kivy/examples/3Drendering/main.py Line 48 in b173ec6
I can see how this can be surprising, but i assure you that kivy is very much able to do 3D rotations, it's just not setup to show the result nicely by default. Hope this helps. Closing as it's rather a support request than a bug report, but i can reopen if you disagree. |
👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project. If you're having trouble installing Kivy, make sure to check out the installation docs for Windows, Linux and macOS. Let us know if this comment was made in error, and we'll be happy to reopen the issue. |
Versions
Description
Rotate instruction (kivy.graphics.Rotate) doesn't rotate the coming vertex instructions correctly when the rotation axis given is x (1, 0, 0) or y (0, 1, 0). Instead the coming matrix is like cropped from its ends away from the point of origin (and respective to the other 2d perpendicular axis).
The right behaviour when rotated on one of the x any axis would look like if the matrix was scaled down around the origin in trigonometric pace ((end-origin)*sin(angle)) (respective to the other 2d perpendicular axis too of course).
For example A rotation of 60 degrees on x-axis should make the shape shorter by one half. And 60 degrees on y-axis should make the shape thinner by one half.
But only one degree distort it like that on x-axis:
And y-axis:
z-axis works perfect like it should:
This isn't an issue of conversion between radians and degrees. (You can adjust the sliders'ranges to be between -pi to pi, but that won't fix it). The cropping happening is non-related to rotation, and the body near origin remain with it's shape unaffected until the copping reach it.
I made a quick look at Rotate class but couldn't spot the glitch. Probably I have to re-study Matrix multiplication in it's compute method. But of course if the issue was approved there would be someone more able to fix it than me.
Code and Logs
I made this app just for demonstration of the issue:
The text was updated successfully, but these errors were encountered: