vray.Transform

class vray.Transform

Bases: object

The object is a composite of a vray.Matrix and a vray.Vector that represent an affine transformation. It supports mathematical operations like multiplication and addition; equality comparison; indexing, where the matrix is [0] and the offset [1]. This object is immutable.

  • Transform() -> new Transform with matrix and offset initialized to 0

  • Transform(matrix, offset) -> new Transform from vray.Matrix and vray.Vector

Attributes

matrix

The rotation & scale matrix

offset

The translation vector

Methods

__init__()

inverse(self)

Returns the inverted matrix and transformed translation vector.

replaceMatrix(self, matrix)

Returns copy of the Transform with the matrix replaced by the given one.

replaceOffset(self, offset)

Returns copy of the Transform with the offset replaced by the given one.

rotate(self, axis)

Returns copy of the Transform with a rotation applied after the current transformation.

scale(self, scale)

Returns copy of the Transform with a scale operation applied after the current transformation.

transformVector(self, vector)

Transform a vector by the transformation, ignoring translation.

translate(self, offset)

Returns copy of the Transform with the offset translated by the given vector.

inverse(self) → Transform

Returns the inverted matrix and transformed translation vector.

replaceMatrix(self, matrix: Matrix) → Transform

Returns copy of the Transform with the matrix replaced by the given one.

replaceOffset(self, offset: Vector) → Transform

Returns copy of the Transform with the offset replaced by the given one.

rotate(self, axis: Vector) → Transform

Returns copy of the Transform with a rotation applied after the current transformation.

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

scale(self, scale: Vector) → Transform

Returns copy of the Transform with a scale operation applied after the current transformation.

transformVector(self, vector: Vector) → Vector

Transform a vector by the transformation, ignoring translation. This is different from operator*, which adds in the translation.

translate(self, offset: Vector) → Transform

Returns copy of the Transform with the offset translated by the given vector.

matrix

The rotation & scale matrix

offset

The translation vector