mirror of https://github.com/kivy/kivy.git
Started adding parameter info
This commit is contained in:
parent
33d3a412e2
commit
a9587cac6a
|
@ -4,10 +4,10 @@
|
||||||
Transformation
|
Transformation
|
||||||
==============
|
==============
|
||||||
|
|
||||||
This module contains a Matrix class used for our Graphics calculation. We
|
This module contains a Matrix class used for our Graphics calculations. We
|
||||||
currently support:
|
currently support:
|
||||||
|
|
||||||
- rotation, translation and scaling matrix
|
- rotation, translation and scaling matrices
|
||||||
- multiplication matrix
|
- multiplication matrix
|
||||||
- clip matrix (with or without perspective)
|
- clip matrix (with or without perspective)
|
||||||
- transformation matrix for 3d touch
|
- transformation matrix for 3d touch
|
||||||
|
@ -57,7 +57,19 @@ cdef class Matrix:
|
||||||
self.identity()
|
self.identity()
|
||||||
|
|
||||||
cpdef Matrix rotate(Matrix self, double angle, double x, double y, double z):
|
cpdef Matrix rotate(Matrix self, double angle, double x, double y, double z):
|
||||||
'''Rotate the matrix with the angle around the axis (x, y, z).
|
'''Rotate the matrix through the angle around the axis (x, y, z)
|
||||||
|
(inplace).
|
||||||
|
|
||||||
|
:Parameters:
|
||||||
|
`angle`: float
|
||||||
|
The angle through which to rotate the matrix
|
||||||
|
`x`: float
|
||||||
|
X position of the point
|
||||||
|
`y`: float
|
||||||
|
Y position of the point
|
||||||
|
`z`: float
|
||||||
|
Z position of the point
|
||||||
|
|
||||||
'''
|
'''
|
||||||
cdef double d, c, s, co, ox, oy, oz, f1, f2, f3, f4, f5, f6, f7, f8, f9
|
cdef double d, c, s, co, ox, oy, oz, f1, f2, f3, f4, f5, f6, f7, f8, f9
|
||||||
with nogil:
|
with nogil:
|
||||||
|
@ -107,7 +119,15 @@ cdef class Matrix:
|
||||||
cpdef Matrix scale(Matrix self, double x, double y, double z):
|
cpdef Matrix scale(Matrix self, double x, double y, double z):
|
||||||
'''Scale the current matrix by the specified factors over
|
'''Scale the current matrix by the specified factors over
|
||||||
each dimension (inplace).
|
each dimension (inplace).
|
||||||
'''
|
|
||||||
|
:Parameters:
|
||||||
|
`x`: float
|
||||||
|
The scale factor along the X axis
|
||||||
|
`y`: float
|
||||||
|
The scale factor along the Y axis
|
||||||
|
`z`: float
|
||||||
|
The scale factor along the Z axis
|
||||||
|
'''
|
||||||
with nogil:
|
with nogil:
|
||||||
self.mat[ 0] *= x;
|
self.mat[ 0] *= x;
|
||||||
self.mat[ 5] *= y;
|
self.mat[ 5] *= y;
|
||||||
|
@ -116,7 +136,15 @@ cdef class Matrix:
|
||||||
|
|
||||||
cpdef Matrix translate(Matrix self, double x, double y, double z):
|
cpdef Matrix translate(Matrix self, double x, double y, double z):
|
||||||
'''Translate the matrix.
|
'''Translate the matrix.
|
||||||
'''
|
|
||||||
|
:Parameters:
|
||||||
|
`x`: float
|
||||||
|
The translation factor along the X axis
|
||||||
|
`y`: float
|
||||||
|
The translation factor along the Y axis
|
||||||
|
`z`: float
|
||||||
|
The translation factor along the Z axis
|
||||||
|
'''
|
||||||
with nogil:
|
with nogil:
|
||||||
self.mat[12] += x
|
self.mat[12] += x
|
||||||
self.mat[13] += y
|
self.mat[13] += y
|
||||||
|
@ -127,6 +155,16 @@ cdef class Matrix:
|
||||||
double zNear, double zFar):
|
double zNear, double zFar):
|
||||||
'''Creates a perspective matrix (inplace).
|
'''Creates a perspective matrix (inplace).
|
||||||
|
|
||||||
|
:Parameters:
|
||||||
|
`fovy`: float
|
||||||
|
???
|
||||||
|
`aspect`: float
|
||||||
|
???
|
||||||
|
`zNear`: float
|
||||||
|
???
|
||||||
|
`zFar`: float
|
||||||
|
???
|
||||||
|
|
||||||
.. versionadded:: 1.6.0
|
.. versionadded:: 1.6.0
|
||||||
'''
|
'''
|
||||||
cdef double f = 1 / tan(fovy / 2. / 360. * 2 * 3.141592653589793)
|
cdef double f = 1 / tan(fovy / 2. / 360. * 2 * 3.141592653589793)
|
||||||
|
|
Loading…
Reference in New Issue