<< >> Up Title 

A transformation of an object (tut08.rt , tut09.rt) or a lamp

transf describes an object rotated, translated, scalated.
 

{ object
    name transfname;
    model { transf
        s x x x;
        r x x x;
        s x x x;
        t x x x;
         ....
        {object
             ....
        }
     }
 }

the object transformation is described by a sequence of r(rotation),

 s(scale), t(translation). The object in the transf. Section can be any type of object, also another transf. transf is a metaobject.
 

In tut08.rt there is a box rotated. The box, centered in the origin, is rotated around z axes.
In tut09.rt a sphere becomes an ellipsoid. The sphere, centred in the origin, is scaled in y axes.
 
If you want to apply a transformation to an object, you must check if the object is centred in the origin, because the rotation and the scale are made on this assumption. If not, the object will be rotate and scaled as you want, but also it will be moved in a unwanted position.

 If you know the center of an object, you should first translate it to the origin of the axis, then you can rotate or scale it how you want. The object will be scaled and rotated, but the center will not move from the origin. Now you can remove the center in the original position.

You can now apply a transformation to a lamp too. The syntax is similar.

{ lamp
    name transfname;
        model { transf
            s x x x;
            r x x x;
            s x x x;
            t x x x;

            ....

        {lamp
                    ....
        }
    }
}

This is usefull for some special effects, like to scale a cone lamp.
 


<< >> Up Title