next up previous contents index
Next: Stretch Up: Transformations Previous: Transformations

Shift

  

The shift function can be specified in two ways:

Either with three variables: the amount the object is to be shifted in the x, y and z directions.

 
object shift(double xshift, double yshift, double zshift, 
             object x);

Or as a vector which contains the amount the object is to be shifted in the x, y and z directions.

 object shift(vector shift_vec, object x);

The example is shown in figure 1

Example

 green_sphere = shift(4,2,-1,green_sphere);

Or

 vector shift_amount;
 Vector:assign(shift_amount,4,2,-1);
 green_sphere = shift(shift_amount,green_sphere);

  figure122
Figure 1: Shifting a sphere (4, 2, -1).



Sophie Day
Fri Feb 20 15:47:19 NZDT 1998