Version 0.55.1

matrix

An vector matrix.

Signatures

  •   matrix( vector row1, vector row2 )
  •   matrix( vector row1, vector row2, vector row3 )
  •   matrix( 4vector row1, 4vector row2, 4vector row3 )
  •   matrix( 4vector row1, 4vector row2, 4vector row3, 4vector row4 )

Details

The basic vector transformation matrix type.

The first constructor may be used to define 2x2 matrices. It implicitly adds an additional row and column containing zero values. The second constructor creates a 3x3 matrix. The third constructor can be used to create a 3x4 affine transformation (including translations). The last constructor creates a general 4x4 matrix.

A similar short-hand notation using double brackets '<[' and ']>' as for vectors exists (see example).

Example

 matrix m1 = <[<[ 0.5,  0.0, -0.5 ]>,
               <[ 0.0,  1.0,  0.0 ]>,
               <[ 2.0,  0.0,  0.5 ]>]>
 echo( m1 )
 

Output

 <[<[0.5,0,-0.5]>,<[0,1,0]>,<[2,0,0.5]>]>
 

Casts To

string

Members

float elmt( int row, int col )

Returns the component of the row with index row and of the column with index col. Index counting starts with 0.

float elmt( int row, int col, float value )

Sets the component of the row with index row and of the column with index col to value value and returns the new value. Index counting starts with 0.

float xx

Allows to read/write the component in the first row and first column of the matrix.

float xy

Allows to read/write the component in the first row and second column of the matrix.

float xz

Allows to read/write the component in the first row and third column of the matrix.

float xw

Allows to read/write the component in the first row and fourth column of the matrix.

float yx

Allows to read/write the component in the second row and first column of the matrix.

float yy

Allows to read/write the component in the second row and second column of the matrix.

float yz

Allows to read/write the component in the second row and third column of the matrix.

float yw

Allows to read/write the component in the second row and fourth column of the matrix.

float zx

Allows to read/write the component in the third row and first column of the matrix.

float zy

Allows to read/write the component in the third row and second column of the matrix.

float zz

Allows to read/write the component in the third row and third column of the matrix.

float zw

Allows to read/write the component in the third row and fourth column of the matrix.

float wx

Allows to read/write the component in the fourth row and first column of the matrix.

float wy

Allows to read/write the component in the fourth row and second column of the matrix.

float wz

Allows to read/write the component in the fourth row and third column of the matrix.

float ww

Allows to read/write the component in the fourth row and fourth column of the matrix.

float det()

Returns the determinant of the matrix.

matrix t()

Returns the transpose matrix.

Parameters

row1

A vector defining the first row of the matrix.

row2

A vector defining the second row of the matrix.

row3

A vector defining the third row of the matrix.

row4

A vector defining the fourth row of the matrix.

See also

🗙

Search results for