Rotation (Transform Node)


The rotation field has four values: x, y and z vector values, and a radian rotation value. Choosing the desired vector for a rotation is an arduous task! Before trying to understand what all the values of the rotation field mean, lets try one:

#VRML V2.0 utf8
#let's rotate!

Transform{
translation 2 3 1
rotation 0 1 0 .785
children[
Shape{
geometry Box{}
} ] }
Transform{
#leave this box untouched
#as a point of reference
children[
Shape{
geometry Box{}
}] }

Note that one of the boxes has not only moved (as a result of the translation) but also has been twisted! Notice too that the twisting (the rotation) occurs around the y-axis. Take another look at the rotation field and its values:

rotation 0 1 0 .785

The first three values are x, y and z values for a vector.The last number (.785) is the radian value of the rotation. This number tells the browser how far (in radians) to rotate the Box.

The rotation vector is defined as a quaternion.


[ Next ] [ Previous ]