Transformation

This module contain a Matrix class, used for our Graphics calculation. We are supporting:

  • rotation, translation, scaling matrix
  • multiply matrix
  • create clip matrix (with or without perspective)
  • transform 3d touch on a matrix
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 matrix to identity matrix (inplace)

inverse()

Return the inverted matrix

multiply()

Multiply the given matrix with self (from the left). I.e., we premultiply the given matrix to the current matrix and return the result (not inplace):

m.multiply(n) -> n * m
rotate()

Rotate the matrix with the angle, around the axis (x, y, z)

scale()

Scale the matrix current Matrix (inplace).

translate()

Translate the matrix

view_clip()

Create a clip matrix (inplace)