Previous:Rotate Main Index Next:Transformation Order

#### Matrix Keyword

The `matrix` keyword can be used to explicitly specify the transformation matrix to be used for objects or textures. Its syntax is:

MATRIX:

`
  matrix <
`Val00`,` Val01`,` Val02`,`
  Val10
`,` Val11`,` Val12`,`
  Val20
`,` Val21`,` Val22`,`
  Val30
`,` Val31`,` Val32`>`

Where Val00 through Val32 are float expressions enclosed in angle brackets and separated by commas. Note this is not a vector. It is a set of 12 float expressions. These floats specify the elements of a 4 by 4 matrix with the fourth column implicitly set to `<0,0,0,1>`. At any given point P, P=<px, py, pz>, is transformed into the point Q, Q=<qx, qy, qz> by

qx = Val00 * px + Val10 * py + Val20 * pz + Val30

qy = Val01 * px + Val11 * py + Val21 * pz + Val31

qz = Val02 * px + Val12 * py + Val22 * pz + Val32

Normally you won't use the matrix keyword because it's less descriptive than the transformation commands and harder to visualize. However the matrix command allows more general transformation effects like shearing. The following matrix causes an object to be sheared along the y-axis.

     object {

      MyObject

      matrix < 1, 1, 0,

           0, 1, 0,

           0, 0, 1,

           0, 0, 0 >

     }

Previous:Rotate Main Index Next:Transformation Order