Table Of Contents
Transformation¶
This module contains a Matrix class used for our Graphics calculation. We currently support:
- rotation, translation and scaling matrix
- multiplication matrix
- clip matrix (with or without perspective)
- transformation matrix for 3d touch
Changed in version 1.6.0: Added Matrix.perspective(), Matrix.look_at() and Matrix.transpose().
- class kivy.graphics.transformation.Matrix¶
Bases: object
Optimized matrix class for OpenGL:
>>> from kivy.graphics.transformation import Matrix >>> m = Matrix() >>> print(m) [[ 1.000000 0.000000 0.000000 0.000000 ] [ 0.000000 1.000000 0.000000 0.000000 ] [ 0.000000 0.000000 1.000000 0.000000 ] [ 0.000000 0.000000 0.000000 1.000000 ]] [ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11] [ 12 13 14 15]
- identity()¶
Reset the matrix to the identity matrix (inplace).
- inverse()¶
Return the inverse of the matrix as a new Matrix.
- look_at()¶
Returns a new lookat Matrix (similar to gluLookAt)
New in version 1.6.0.
- multiply()¶
Multiply the given matrix with self (from the left) i.e. we premultiply the given matrix by the current matrix and return the result (not inplace):
m.multiply(n) -> n * m
- normal_matrix()¶
Computes the normal matrix, which is the inverse transpose of the top left 3x3 modelview matrix used to transform normals into eye/camera space.
New in version 1.6.0.
- perspective()¶
Creates a perspective matrix (inplace).
New in version 1.6.0.
- project()¶
Project a point from 3d space into a 2d viewport.
New in version 1.7.0.
- rotate()¶
Rotate the matrix with the angle around the axis (x, y, z).
- scale()¶
Scale the current matrix by the specified factors over each dimension (inplace).
- translate()¶
Translate the matrix.
- transpose()¶
Return the transposed matrix as a new Matrix.
New in version 1.6.0.
- view_clip()¶
Create a clip matrix (inplace).
Changed in version 1.6.0: Enable support for perspective parameter.