Created
January 12, 2024 13:21
-
-
Save portnov/d76d40c854b2c13e7d2d9d38f45688f6 to your computer and use it in GitHub Desktop.
Matrix rotations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from mathutils import Matrix, Vector | |
>>> axis = Vector((1,1,2)) | |
>>> m1 = Matrix.Rotation(1.2, 4, axis) | |
>>> m1 | |
Matrix(((0.46863141655921936, -0.6547330021858215, 0.5930507779121399, 0.0), | |
(0.8672804236412048, 0.46863141655921936, -0.16795594990253448, 0.0), | |
(-0.16795594990253448, 0.5930507779121399, 0.7874525189399719, 0.0), | |
(0.0, 0.0, 0.0, 1.0))) | |
>>> from math import pi | |
>>> m2 = -1 * m1 | |
>>> m2 | |
Matrix(((-0.46863141655921936, 0.6547330021858215, -0.5930507779121399, -0.0), | |
(-0.8672804236412048, -0.46863141655921936, 0.16795594990253448, -0.0), | |
(0.16795594990253448, -0.5930507779121399, -0.7874525189399719, -0.0), | |
(-0.0, -0.0, -0.0, -1.0))) | |
>>> m3 = Matrix.Rotation(1.2 + pi, 4, axis) | |
>>> m3 | |
Matrix(((-0.1352979689836502, 0.9880663752555847, 0.07361578941345215, 0.0), | |
(-0.5339471697807312, -0.1352979689836502, 0.8346225619316101, 0.0), | |
(0.8346225619316101, 0.07361578941345215, 0.5458807945251465, 0.0), | |
(0.0, 0.0, 0.0, 1.0))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment