Logo Euclid

AutoOpenMatrix Module

When Euclid is opened this module will be auto-opened. It only contains extension members for type Matrix.

Type extensions

Type extension Description

this.Decompose

Full Usage: this.Decompose

Parameters:
    () : unit

Returns: MatrixDecomposition The decomposition. d.ToMatrix recomposes the matrix.

Decomposes this affine Matrix into translation, rotation, scale and shear. Applied to a point in this order, they give the same transformation as the matrix: first scale, then shear, then rotate and last translate. Fails if the matrix is projecting, or if it is singular, that is if a scale factor is less than 1e-12.

Extended Type: Matrix

() : unit
Returns: MatrixDecomposition

The decomposition. d.ToMatrix recomposes the matrix.

this.Interpolate

Full Usage: this.Interpolate

Parameters:
    finish : Matrix - The matrix at factor 1.
    factor : float - The finite interpolation factor.

Returns: Matrix A new interpolated affine Matrix.

Interpolates from this matrix to finish for animations, by decomposing both into translation, rotation, scale and shear and interpolating these. The translation, scale and shear are interpolated linearly. The rotation is interpolated with Quaternion.slerp along the shortest rotation, at a constant angular speed. Factor 0 returns this matrix and factor 1 returns finish. The factor is not clamped: negative factors and factors above one extrapolate. If only one of the matrices is mirroring, the interpolated matrix collapses on the way, when its X scale passes zero. Fails if the factor is not finite, or if this matrix or finish is projecting or singular.

Extended Type: Matrix

finish : Matrix

The matrix at factor 1.

factor : float

The finite interpolation factor.

Returns: Matrix

A new interpolated affine Matrix.

this.TryDecompose

Full Usage: this.TryDecompose

Parameters:
    () : unit

Returns: MatrixDecomposition voption ValueSome decomposition, or ValueNone for a projecting or singular matrix.

Tries to decompose this affine Matrix into translation, rotation, scale and shear. Applied to a point in this order, they give the same transformation as the matrix: first scale, then shear, then rotate and last translate. Returns ValueNone if the matrix is projecting, or if it is singular, that is if a scale factor is less than 1e-12.

Extended Type: Matrix

() : unit
Returns: MatrixDecomposition voption

ValueSome decomposition, or ValueNone for a projecting or singular matrix.

Matrix.createFromDecomposition d

Full Usage: Matrix.createFromDecomposition d

Parameters:
Returns: Matrix A new affine Matrix.

Recomposes a Matrix from its translation, rotation, scale and shear. Same as d.ToMatrix.

Extended Type: Matrix

d : MatrixDecomposition

The decomposition to recompose.

Returns: Matrix

A new affine Matrix.

Matrix.createFromRigidMatrix m

Full Usage: Matrix.createFromRigidMatrix m

Parameters:
Returns: Matrix

Create 4x4 matrix from 3x3 rigid matrix. The last column is set to (0,0,0,1).

Extended Type: Matrix

m : RigidMatrix
Returns: Matrix

Matrix.decompose m

Full Usage: Matrix.decompose m

Parameters:
    m : Matrix - The matrix to decompose.

Returns: MatrixDecomposition The decomposition. d.ToMatrix recomposes the matrix.

Decomposes an affine Matrix into translation, rotation, scale and shear. Applied to a point in this order, they give the same transformation as the matrix: first scale, then shear, then rotate and last translate. The shear is upper triangular, so the X-axis is never sheared. For a mirroring matrix the scale along the X-axis is negative. Fails if the matrix is projecting, or if it is singular, that is if a scale factor is less than 1e-12.

Extended Type: Matrix

m : Matrix

The matrix to decompose.

Returns: MatrixDecomposition

The decomposition. d.ToMatrix recomposes the matrix.

Matrix.interpolate start finish factor

Full Usage: Matrix.interpolate start finish factor

Parameters:
    start : Matrix - The matrix at factor 0.
    finish : Matrix - The matrix at factor 1.
    factor : float - The finite interpolation factor.

Returns: Matrix A new interpolated affine Matrix.

Interpolates from start to finish for animations, by decomposing both into translation, rotation, scale and shear and interpolating these. The translation, scale and shear are interpolated linearly. The rotation is interpolated with Quaternion.slerp along the shortest rotation, at a constant angular speed. Unlike an interpolation of the 16 matrix elements, this keeps a rotation rigid and does not shrink it on the way. Factor 0 returns start and factor 1 returns finish. The factor is not clamped: negative factors and factors above one extrapolate. If only one of the matrices is mirroring, the interpolated matrix collapses on the way, when its X scale passes zero. Fails if the factor is not finite, or if start or finish is projecting or singular.

Extended Type: Matrix

start : Matrix

The matrix at factor 0.

finish : Matrix

The matrix at factor 1.

factor : float

The finite interpolation factor.

Returns: Matrix

A new interpolated affine Matrix.

Matrix.tryDecompose m

Full Usage: Matrix.tryDecompose m

Parameters:
    m : Matrix - The matrix to decompose.

Returns: MatrixDecomposition voption ValueSome decomposition, or ValueNone for a projecting or singular matrix.

Tries to decompose an affine Matrix into translation, rotation, scale and shear. Applied to a point in this order, they give the same transformation as the matrix: first scale, then shear, then rotate and last translate. The shear is upper triangular, so the X-axis is never sheared. For a mirroring matrix the scale along the X-axis is negative. Returns ValueNone if the matrix is projecting, or if it is singular, that is if a scale factor is less than 1e-12.

Extended Type: Matrix

m : Matrix

The matrix to decompose.

Returns: MatrixDecomposition voption

ValueSome decomposition, or ValueNone for a projecting or singular matrix.

Type something to start searching.