A 4x4 row-major floating point matrix. Supports pickling.
Most methods completely override the old state, so “chaining” method calls is not possible.
m = Matrix()
m.scale((2, 2, 2)) #This is useless, it will be overwritten soon.
m.translate((0, 1, 4)) #Set m as a translation vector. All previous data is overwritten.
Creates a new identity matrix.
Creates a new matrix from another one.
Creates a new matrix from a sequence. If the lenght of the sequence is 4 it is assumed to be a some kind of a matrix and will be accessed as sequence[row][col]. If the lenght of the sequence is 16 it will be accessed as a 1D-list, for example the list returned by toList() is a valid argument.
Sets self as an identity matrix.
Inverses self and returns the determinant. Raises an exception if the inverse can’t be done.
Parameters: |
|
---|
Sets self as a left handed view matrix.
Parameters: |
|
---|
Sets self as a left handed orthographic projection matrix.
Parameters: |
|
---|
Sets self as a left handed perspective projection matrix.
Sets self as a rotation matrix.
Sets self as a scaling matrix.
Parameters: |
|
---|
Sets self as transformation vector.
Transforms the argument normal and returns the result.
Transforms the argument vector and returns the result.
Sets self as a translation matrix.
Transposes self.
Returns self as a 1D list.
Matrix multiply. Also supports in-place (*=) operation.
Indices are zero-based.
Returns the indexed value.
Sets the indexed value.
m = Matrix()
m[3,0] = 8.0 #Set x-translation to 8.0
m[3,1] = 5.0 #Set y-translation to 5.0
m[3,2] = 2.0 #Set z-translation to 2.0