<scale-matrix4> ( factors -- matrix )
Extra matrix operations

Prev:<scale-matrix3> ( factors -- matrix )
Next:<skew-matrix4> ( theta -- matrix )


Vocabulary
math.matrices.extras

Inputs
factorsa sequence


Outputs
matrixa matrix


Word description
Make a 4 x 4 scaling matrix, used to scale an object in 3 or more dimensions. See scaling matrix on Wikipedia.

Notes
Only the first three values in factors are used.
This word is the 4-matrix variant of <scale-matrix3>.


Examples
USING: math.matrices.extras prettyprint ; { 22 33 -44 } <scale-matrix4> .
{ { 22 0.0 0.0 0.0 } { 0.0 33 0.0 0.0 } { 0.0 0.0 -44 0.0 } { 0.0 0.0 0.0 1.0 } }


Definition


:: <scale-matrix4> ( factors -- matrix )
factors >scale-factors :> ( x y z ) {
{ x 0.0 0.0 0.0 }
{ 0.0 y 0.0 0.0 }
{ 0.0 0.0 z 0.0 }
{ 0.0 0.0 0.0 1.0 }
} ;