vray.Matrix

class vray.Matrix

Bases: object

A 3x3 column-major matrix. Each column is a vray.Vector that can be indexed. The usual mathematical operations are supported as well as equality checks. This object is immutable.

  • Matrix() -> new Matrix initialized to all zeroes

  • Matrix(diagonal) -> new Matrix initialized with ‘diagonal’ along the diagonal

  • Matrix(col0, col1, col2) -> new Matrix initialized with the 3 vray.Vector-s

Attributes

column0

Column0 of the matrix

column1

Column1 of the matrix

column2

Column2 of the matrix

identity

zero

Methods

__init__()

addDiagonal

Gets a copy of the matrix with added diagonal

addTransposed

Gets a copy of the matrix with added another matrix transposed.

inverse

Compute the inverse of a matrix.

makeRotationMatrixX

Creates a rotational matrix around the x axis given an angle in radians.

makeRotationMatrixY

Creates a rotational matrix around the y axis given an angle in radians.

makeRotationMatrixZ

Creates a rotational matrix around the z axis given an angle in radians.

orthogonal

Get a orthogonal copy of the matrix(each column vector is orthogonal to the other two in 3D space).

orthonormal

Get a orthonormal copy of the matrix

outerProduct

Gets an outer product matrix of the two given vray.Vector-s.

replaceColumn

Get a copy of the matrix with changed column.

replaceRow

Get a copy of the matrix with changed row.

rotate

Get a copy of this matrix rotated around the given axis.

transpose

Get a transposed copy of the matrix.

withoutScale

Get the copy of the matrix with normalised columns.

addDiagonal()

Gets a copy of the matrix with added diagonal

  • diag - New vector value

addTransposed()

Gets a copy of the matrix with added another matrix transposed.

  • matrix - Another matrix to transpose and add

inverse()

Compute the inverse of a matrix.

static makeRotationMatrixX()

Creates a rotational matrix around the x axis given an angle in radians.

static makeRotationMatrixY()

Creates a rotational matrix around the y axis given an angle in radians.

static makeRotationMatrixZ()

Creates a rotational matrix around the z axis given an angle in radians.

orthogonal()

Get a orthogonal copy of the matrix(each column vector is orthogonal to the other two in 3D space).

orthonormal()

Get a orthonormal copy of the matrix

static outerProduct()

Gets an outer product matrix of the two given vray.Vector-s.

replaceColumn()

Get a copy of the matrix with changed column.

  • index - Column index to be changed.

  • vector - New vector value

replaceRow()

Get a copy of the matrix with changed row.

  • index - Row index to be changed.

  • vector - New vector value

rotate()

Get a copy of this matrix rotated around the given axis.

  • axis - An axis vector to rotate around. The length of the axis is the tangent of the angle of rotation.

transpose()

Get a transposed copy of the matrix.

withoutScale()

Get the copy of the matrix with normalised columns. This effectively removes scaling from a transform matrix.

column0

Column0 of the matrix

column1

Column1 of the matrix

column2

Column2 of the matrix

identity = Matrix(Vector(1, 0, 0), Vector(0, 1, 0), Vector(0, 0, 1))
zero = Matrix(Vector(0, 0, 0), Vector(0, 0, 0), Vector(0, 0, 0))