A SERVICE OF

logo

80
Chapter 6: Placing Shapes in a Scene
Setting the Transformation
The csTransform node allows you to set the location (translation), rotation, and scale of
its children using the following methods:
void setTranslation(const csVec3f& translation);
void setTranslation(csFloat v0, csFloat v1, csFloat v2);
void setRotation(const csRotation& rotation);
void setRotation(csFloat v0, csFloat v1, csFloat v2, csFloat v3);
void setScale(const csVec3f& scale);
void setScale(csFloat v0, csFloat v1, csFloat v2);
void setScaleOrientation(const csRotation& scaleOrientation);
void setScaleOrientation(csFloat v0, csFloat v1, csFloat v2,
csFloat v3);
void setCenter(const csVec3f& center);
void setCenter(csFloat v0, csFloat v1, csFloat v2);
void setMatrix(Matrix4f mat)
There is a corresponding set of get...() methods for each of these methods.
Each method is overridden so that you can specify the arguments to the methods either
as objects or individual coordinates.
setTranslation() positions the children of the transform in the space of the node that is
the parent to csTransform.
setCenter() species the point around which an object rotates.
setRotation() rotates the children of the transform around the point specied in
setCenter().
setScale() specify the scale factor of the children of the transform along the X, Y, and Z
axes.
setScaleOrientation() species the orientation in which the scaling takes effect.
Figure 6-2 shows a shape scaled by a factor of 2 in two different orientations, 0 and 45
degrees, respectively.