→ index of namespace default
 
→ index of project tkmath
 
→ index of module tkmath

Class tkmath.Matrix2f


Synopsis: This class represents a single precision 2x2 square matrix.

  Base classes:
  Methods: Description:


The default layout is row-major. 0 1 = a b 2 3 c d


 
→ top of page

Method add
Add another matrix m to this instance
Signature
add(Matrix2fm)
Arguments
Matrix2fm–matrix to add

 
→ top of page
Method det
Calculate determinant of matrix
Signature
det():float
Returns
float–value of determinant

 
→ top of page
Method getA
Get value of a element
Signature
getA():float
Returns
float–value of a element

 
→ top of page
Method getAbs
Calculate the Hilbert-Schmidt norm of the matrix
Signature
getAbs():float
Returns
float–scalar matrix norm value

 
→ top of page
Method getAbsSqr
Calculate the squared Hilbert-Schmidt norm of the matrix
Signature
getAbsSqr():float
Returns
float–scalar matrix norm value

 
→ top of page
Method getB
Get value of b element
Signature
getB():float
Returns
float–value of b element

 
→ top of page
Method getC
Get value of c element
Signature
getC():float
Returns
float–value of c element

 
→ top of page
Method getCol
Get column 'col' vector
Signature
getCol(intcol)
 :Vector2f
Arguments
intcol–column index
Returns
Vector2f–vector with values from column c

 
→ top of page
Method getD
Get value of d element
Signature
getD():float
Returns
float–value of d element

 
→ top of page
Method getRow
Get row 'row' vector
Signature
getRow(introw)
 :Vector2f
Arguments
introw–row index
Returns
Vector2f–vector with values from row 'row'

 
→ top of page
Method getString
Get string representation of matrix ((a, b), (c, d))
Signature
getString():String
Returns
String–string representation of matrix

 
→ top of page
Method init
Initialize matrix (in matrix order, default=row-major)
Signature
init(floata,
  floatb,
  floatc,
  floatd 
  )  
Arguments
floata–value for m11
floatb–value for m12
floatc–value for m22
floatd–value for m23

 
→ top of page
Method initColf
Initialize matrix column from scalars
Signature
initColf(intcol,
  floata,
  floatb 
  )  
Arguments
intcol–column index
floata–value for first row
floatb–value for second row

 
→ top of page
Method initColumnMajor
Initialize matrix (column-major arg order. swap args if matrix is in (default) row-major order).
Signature
initColumnMajor(floata,
  floatb,
  floatc,
  floatd 
  )  
Arguments
floata–value for m11
floatb–value for m21
floatc–value for m12
floatd–value for m22

 
→ top of page
Method initColv
Initialise matrix column from vector or array-like object
Signature
initColv(intcol,
  Vector2fv 
  )  
Arguments
intcol–column index
Vector2fv–vector with values

 
→ top of page
Method initIdentity
Initialize with identity matrix.
Signature
initIdentity()

 
→ top of page
Method initRotatef
Signature
initRotatef()

 
→ top of page
Method initRowf
Initialize matrix row from scalars
Signature
initRowf(introw,
  floata,
  floatb 
  )  
Arguments
introw–row index
floata–value for first column
floatb–value for second column

 
→ top of page
Method initRowMajor
Initialize matrix (row-major arg order. swap args if matrix is in (non-default) column-major order).
Signature
initRowMajor(floata,
  floatb,
  floatc,
  floatd 
  )  
Arguments
floata–value for m11
floatb–value for m12
floatc–value for m21
floatd–value for m22

 
→ top of page
Method initRowV
Initialize matrix row from vector or array-like object
Signature
initRowV(introw,
  Vector2fv 
  )  
Arguments
introw–
Vector2fv–vector with values

 
→ top of page
Method initScalef
Signature
initScalef()

 
→ top of page
Method initScalev
Signature
initScalev()

 
→ top of page
Method initSkewXf
a in radians (0..2PI)
Signature
initSkewXf()
Description
see https://www.w3.org/TR/css-transforms-1/#SkewXDefined

 
→ top of page
Method initSkewYf
a in radians (0..2PI)
Signature
initSkewYf()

 
→ top of page
Method initTranspose
Initialize matrix (swap arg row/column order).
Signature
initTranspose(floata,
  floatb,
  floatc,
  floatd 
  )  
Arguments
floata–value for m11
floatb–value for m12
floatc–value for m13
floatd–value for m21

 
→ top of page
Method invert
Calculate inversion of matrix, so that A*A-1=U
Signature
invert()

 
→ top of page
Method isIdentity
Check if this is an identity matrix (diagonal=1, other=0)
Signature
isIdentity()

 
→ top of page
Method mul
Multiply this instance by matrix m (this * m)
Signature
mul(Matrix2fm)
Arguments
Matrix2fm–matrix to multiply

 
→ top of page
Method mulf
Multiply this instance by scalar value v
Signature
mulf(floatv)
Arguments
floatv–value to multiply

 
→ top of page
Method mulRev
Reverse-multiply matrix m by this instance (m * this)
Signature
mulRev(Matrix2fm)
Arguments
Matrix2fm–matrix to multiply

 
→ top of page
Method mulv
Multiply this instance by a 2dim vector
Signature
mulv(Vector2fv)
 :Vector2f
Arguments
Vector2fv–vector to multiply
Returns
Vector2f–resulting vector

 
→ top of page
Method New
Initialize and return new instance of Matrix2f (args are in row-major order)
Signature
New(floatva,
  floatvb,
  floatvc,
  floatvd 
  )  
 :Matrix2f
Arguments
floatva–
floatvb–
floatvc–
floatvd–
Returns
Matrix2f–new instance of Matrix2f

 
→ top of page
Method rotatef
Multiply by rotation matrix (angle is in radiant measure)
Signature
rotatef(floatang)
Arguments
floatang–

 
→ top of page
Method scalef
Multiply by scale matrix
Signature
scalef(floatx,
  floaty,
  floatz 
  )  
Arguments
floatx–
floaty–
floatz–

 
→ top of page
Method scalev
Multiply by scale matrix
Signature
scalev(Vector2fv)
Arguments
Vector2fv–

 
→ top of page
Method setA
Set a element to v
Signature
setA(floatv)
Arguments
floatv–new value for a

 
→ top of page
Method setB
Set b element to v
Signature
setB(floatv)
Arguments
floatv–new value for b

 
→ top of page
Method setC
Set c element to v
Signature
setC(floatv)
Arguments
floatv–new value for c

 
→ top of page
Method setCol
Initialize column 'col' with values from 'v'
Signature
setCol(intcol,
  Vector2fv 
  )  
Arguments
intcol–column index
Vector2fv–Vector2f instance

 
→ top of page
Method setD
Set d element to v
Signature
setD(floatv)
Arguments
floatv–new value for d

 
→ top of page
Method setRow
Initialize row 'row' with values from 'v'
Signature
setRow(introw,
  Vector2fv 
  )  
Arguments
introw–row index
Vector2fv–Vector2f instance

 
→ top of page
Method sub
Substract another matrix m from this instance
Signature
sub(Matrix2fm)
Arguments
Matrix2fm–matrix to substract

 
→ top of page
Method transpose
Transpose matrix
Signature
transpose()

 
→ top of page
Method unit
Normalize matrix using Hilbert-Schmidt norm
Signature
unit()

 
→ top of page
Method unitScale
Normalise matrix using Hilbert-Schmidt norm and multiply by 's' afterwards
Signature
unitScale(floats)
Arguments
floats–scaling factor

 
→ top of page
 

Project Modules:tkmath 
Project Classes:Complexd , Complexf , Math , Matrix , Matrix2d , Matrix2f , Matrix2x3f , Matrix3d , Matrix3f , Matrix4d , Matrix4f , Quaterniond , Quaternionf , Vector2d , Vector2f , Vector3d , Vector3f , Vector4d , Vector4f 
Project Functions:absd , absf , acoscd , acoscf , acosd , acosf , acoshcd , acoshcf , acoshd , acoshf , asincd , asincf , asind , asinf , asinhcd , asinhcf , asinhd , asinhf , atan2d , atan2f , atancd , atancf , atand , atanf , atanhcd , atanhcf , atanhd , atanhf , ceild , ceilf , complexd , complexf , complexfPolar , complexfPolar , coscd , coscf , cosd , cosf , coshcd , coshcf , coshd , coshf , exp10d , exp10f , exp2d , exp2f , expcd , expcf , expd , expf , f16_from_f32 , f32_from_f16 , floord , floorf , fx16_from_f16 , hypotd , hypotf , log10d , log10f , log2d , log2f , logcd , logcf , logd , logf , matrix2d , matrix2f , matrix2x3f , matrix3d , matrix3f , matrix4d , matrix4f , modd , modf , powcd , powcf , powd , powf , quaterniond , quaternionf , relCmpd , relCmpf , relErrCmpd , relErrCmpf , roundd , roundf , sincd , sincf , sind , sinf , sinhcd , sinhcf , sinhd , sinhf , sqrtcd , sqrtcf , sqrtd , sqrtf , tancf , tancf , tand , tanf , tanhcd , tanhcf , tanhd , tanhf , vector2d , vector2f , vector3d , vector3f , vector4d , vector4f 
All Namespaces:default , graph , ui 
All Projects:core , eqxmms , ShaderVG , ShaderVG_Text , tkanalogrytm , tkchipmunk , tkclap , tkfileutils , tkfreeglut , tkfreetype2 , tkfreeverb , tkmath , tkmidi , tkmidipipe , tkminnie , tkoldmath , tkopengl , tkportaudio , tkradiastools , tksamplechain , tksampleedit , tksampler , tksdl , tksdl_net , tksidplay2 , tkspeexdsp , tksqlite , tktriangulate , tkui , tkvst2 , tkzip , ui , yingtest 


auto-generated by "DOG", the TkScript document generator. Tue, 3/Mar/2026 18:10:18