Skip to contents

Decompose a transformation matrix into its translation, rotation, and scale components.

Usage

matrix_decompose(mat)

Arguments

mat

A 4x4 numeric matrix.

Value

A list with elements translation (numeric vector of length 3), rotation (numeric vector of length 4, quaternion), and scale (numeric vector of length 3).

Examples

result <- matrix_decompose(diag(4))
result$translation
#> x y z 
#> 0 0 0 
result$rotation
#> x y z w 
#> 0 0 0 1 
result$scale
#> x y z 
#> 1 1 1