5.79. Translation (transformation)

<transformation geometry="translation"> ‐ A translation transformation

5.79.1. Attributes

NameTypeDefaults
idIDNone (required)
xFLOAT0.0
yFLOAT0.0
zFLOAT0.0
matrixFLOAT MATRIXNone (read-only)

5.79.2. Description

This element defines a translation by a 3D vector.

The float values of the x, y, and z attributes define the coordinates of the translation vector.

The value of the read-only attribute matrix is a 4x4 float matrix that represents the current translation matrix.

5.79.3. Expected child

None.

5.79.4. Example

In the example below, the quad quad#1 is translated by vector


            ( rand(-2,2) , -0.01 , rand(-2,-1) )
rand(-2, 2) is a function that outputs a random number between -2 and 2.

<node id="subdivision">
  <transformation  id="transfsubdivision"
      geometry="translation" x="rand(-2,2)" y="-.01" z="rand(-2,-1)" />
  <node id="quad">
    <quad id="quad#1"
        x1="5" y1="-.01" z1="5"
        x2="5" y2="-.01" z2="-5"
        x3="-5" y3="-.01" z3="-5"
        x4="-5" y4="-.01" z4="5" >
      <texture encoding="jpeg" xlink:href="textures/sea.jpg" 
        id="subdivisions1" tile_s="1" tile_t="1" />
    </quad>
  </node>  
</node>