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 ]]
identity

Matrix.identity(self) -> Matrix Reset matrix to identity matrix (inplace)

inverse

Matrix.inverse(self) -> Matrix Return the inverted matrix

multiply

Matrix.multiply(mb, Matrix ma) -> Matrix Return a new matrix of self * arg

rotate

Matrix.rotate(self, double angle, double x, double y, double z) -> Matrix Rotate the matrix with the angle, around the axis (x, y, z)

scale

Matrix.scale(self, double x, double y, double z) -> Matrix Scale the matrix

transform_point

Matrix.transform_point(self, double x, double y, double z) -> tuple

translate

Matrix.translate(self, double x, double y, double z) -> Matrix Translate the matrix

view_clip

Matrix.view_clip(self, double left, double right, double bottom, double top, double near, double far, int perspective) -> Matrix Create a clip matrix (inplace)