6.3 - Translating

Translating a model changes the model’s location. Translation does not affect the model’s size or orientation. Mathematically, translating is a simple addition. Translating a vertex, (x, y, z), into a new location, (x_new, y_new, z_new), 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_new = x + tx;
y_new = y + ty;
z_new = 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 translating a model.

Please use a browser that supports "canvas"
Animate
X translation 0.00 : -2.0 2.0
Y translation 0.00 : -2.0 2.0
Z translation 0.00 : -2.0 2.0

Open this webgl demo 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 translating by (-2, 3, -1) puts it back in its original location.

Glossary

translate
Change the location of a model.

Self Assessment

    Q-126: Translating a model requires a(n) _____________ operation on each vertex in the model.
  • addition
  • Correct. Addition is used for translation.
  • multiplication
  • Incorrect. Multiplication performs scaling.
  • division
  • Incorrect. Division performs scaling.
  • subtraction
  • Subtraction does perform translation, but we normally think of translation as pure addition. To move "backwards" you add a negative value.
    Q-127: Translating a model 3 units in the direction of the x axis would use which translation values.
  • 3, 0, 0
  • Correct. The x-axis component gets increased by 3 units and the y and z components do not change.
  • 3
  • Incorrect. Translation acts on a vertex, which has 3 components. You need 3 translation values, even if 2 of the components are not changing.
  • 0, 0, 3
  • Incorrect. This would move 3 units in the direction of the z axis.
  • 1.5
  • Incorrect. Translation uses addition. (And you need 3 translation values, not just 1.)
    Q-128: Translating a model in the direction of a vector <dx, dy, dz> would use what translation values?
  • dx, dy, dz
  • Correct. You add the vector to every vertex in the model.
  • dy, dz, dx
  • Incorrect. The values you add must be consistent with the vertex component values (x, y, z).
  • 1, 2, 3
  • Incorrect. These values would move 1 unit in the x direction, 2 units in the y direction, and 3 units in the z direction, but this has nothing to do with the vector .
  • tx, ty, tz
  • Incorrect. In general we have 3 translation values, and we generically call them tx, ty, and tz, but this has nothing to do with the vector .
Next Section - 6.4 - Rotating