6.3 - Translating

Translating a model changes the model’s location. Translation does not effect the model’s size or orientation. Mathematically, translating is a simple addition. Translating a vertex, (x, y, z), into a new location, (x’, y’, z’), is accomplished by adding a value to each component. Let’s call these translation values tx, ty, and tz. In equation format, translation is performed like this:

x' = x + tx;
y' = y + ty;
z' = z + tz;

Notice that translating by 0 leaves a component value unchanged. Vertices are typically manipulated as a unit, so if you want to translate along one axis and leave the other axes unchanged, use a translation value of 0 for the unchanged axes.

Special Cases and Effects

There are no “special cases” for translation. Experiment with the following example.

An example of model translation.

Please use a browser that supports "canvas"
Animate
tx -6.0 6.0 tx : 0.00
ty -2.0 2.0 ty : 0.00
tz -2.0 2.0 tz : 0.00

Limiting the translation values between -2 to +2 on the Y and Z axes keep the model inside the WebGL viewing area. Experiment with the larger X axis translation values which make the model disappear from view.

Open this webgl program in a new tab or window

To negate (or undo) a translation operation, simply translate using a negative (-tx, -ty, -tz) translation. For example, if you translated a model by (2, -3, 1), then translate by (-2, 3, -1) to put it back.

Glossary

translate
Change the location of a model.

Self Assessment

Question-1: Translating a model 3 units in the direction of the x axis would use which translation values.





Question-2: Translating a model in the direction of a vector <dx, dy, dz> would use what translation values?





Next Section - 6.4 - Rotating