Graphics Reference
In-Depth Information
The built-in functions that operate on matrices are described in Table B-6.
Table B-6
Matrix Functions
Syntax
Description
mat2
matrixCompMult
(mat2
x
, mat2
y
)
mat3
matrixCompMult
(mat3
x
, mat3
y
)
mat4
matrixCompMult
(mat4
x
, mat4
y
)
Multiply matrix
x
by matrix
y
component-wise, i.e.,
result
[
i
][
j
] is the
scalar product of
x
[
i
][
j
] and
y
[
i
][
j
].
Note: To get linear algebraic matrix
multiplication, use the multiply
operator (*).
mat2
outerProduct
(vec2
c
, vec2
r
)
mat3
outerProduct
(vec3
c
, vec3
r
)
mat4
outerProduct
(vec4
c
, vec4
r
)
Treats the first parameter
c
as a
column vector (matrix with one
column) and the second parameter
r
as a row vector (matrix with one row)
and does a linear algebraic matrix
multiply
c
*
r
, yielding a matrix
whose number of rows is the number
of components in
c
and whose
number of columns is the number of
components in
r
.
mat2x3
outerProduct
(vec3
c
, vec2
r
)
mat3x2
outerProduct
(vec2
c
, vec3
r
)
mat2x4
outerProduct
(vec4
c
, vec2
r
)
mat4x2
outerProduct
(vec2
c
, vec4
r
)
mat3x4
outerProduct
(vec4
c
, vec3
r
)
mat4x3
outerProduct
(vec3
c
, vec4
r
)
mat2
transpose
(mat2
m
)
mat3
transpose
(mat3
m
)
mat4
transpose
(mat4
m
)
mat2x3
transpose
(mat3x2
m
)
mat3x2
transpose
(mat2x3
m
)
mat2x4
transpose
(mat4x2
m
)
mat4x2
transpose
(mat2x4
m
)
mat3x4
transpose
(mat4x3
m
)
mat4x3
transpose
(mat3x4
m
)
Returns a matrix that is the
transpose of
m
. The input matrix
m
is not modified.
float
determinant
(mat2
m
)
float
determinant
(mat3
m
)
float
determinant
(mat4
m
)
Returns the determinant of
m
.
mat2
inverse
(mat2
m
)
mat3
inverse
(mat3
m
)
mat4
inverse
(mat4
m
)
Returns a matrix that is the inverse of
m
. The input matrix
m
is not modified.
The values in the returned matrix are
undefined if
m
is singular or poorly
conditioned (nearly singular).