class M22f

2x2 floating point transformation matrix.

M22f()

Default constructor: initialize to identity

1 0
0 1
M22f(a: float)

Initialize to scalar constant

a a
a a
M22f(a: float, b: float, c: float, d: float)

Construct from given scalar values:

a b
c d
__getitem__(i: int) V2f

Return the i-th row.

__eq__(o: M22f) bool

Return True if both matrix are equal.

__neq__(o: M22f) bool

Return True if both matrix are not equal.

__mul__(o: M22f) M22f

Matrix-matrix multiplication

__mul__(a: float) M22f

Component-wise multiplication

__truediv__(a: float) M22f

Component-wise division

__add__(o: M22f) M22f

Component-wise addition

__sub__(o: M22f) M22f

Component-wise subtraction

__neg__() M22f

Component-wise multiplication by -1

determinant() float

Determinant

equalWithAbsError(m: M22f, e: float) bool

Compare two matrices and test if they are “approximately equal”: @return True if the coefficients of this and m are the same with an absolute error of no more than e, i.e., for all i, j:

abs (this[i][j] - m[i][j]) <= e

equalWithRelError(m: M22f, e: float) bool

Compare two matrices and test if they are “approximately equal”: @return True if the coefficients of this and m are the same with a relative error of no more than e, i.e., for all i, j:

abs (this[i] - v[i][j]) <= e * abs (this[i][j])

fastMinor(r0: int, r1: int, c0: int, c1: int) float

Build a minor using the specified rows and columns

inverse() M22f

Return the inverse using the determinant, leaving this unmodified.

invert()

Invert in place using the determinant

negate()

Component-wise multiplication by -1

makeIdentity()

Set to the identity matrix

multDirMatrix(v: V2f) V2f

Transform the vector v by the matrix

rotate(r: float)

Rotate the matrix by r (in radians)

scale(s: V2f)

Scale the matrix by s

setRotation(r: float)

Set matrix to rotation by r (in radians)

setScale(s: float)

Set matrix to scale by given uniform factor

setScale(r: V2f)

Set matrix to scale by given vector

transpose()

Transpose

transposed() M22f

Return the transpose