Presentation is loading. Please wait.

Presentation is loading. Please wait.

Transformations in 3D Lecture 17 Mon, Oct 6, 2003.

Similar presentations


Presentation on theme: "Transformations in 3D Lecture 17 Mon, Oct 6, 2003."— Presentation transcript:

1 Transformations in 3D Lecture 17 Mon, Oct 6, 2003

2 3D Affine Transformations In 3-dimensional scenes we have the same three kinds of transformation. Translations. Rotations. Scalings. Points have three coordinates (x, y, z), with a fourth coordinate w = 1 added: (x, y, z, 1)

3 3D Translations 100dx 010dy 001dz 0001 x y z 1 x’ y’ z’ 1 = The translation T(dx, dy, dz).

4 3D Scalings sxsx 000 0sysy 00 00szsz 0 0001 x y z 1 x’ y’ z’ 1 = The scaling S(s x, s y, s z ).

5 3D Rotations Rotations in space are a little more complicated. A rotation in space is about an axis, not a point. Any line may be the axis of rotation. Generally we rotate about the x, y, and z axes.

6 3D Rotations about the z-axis cos  –sin  00 sin  cos  00 0010 0001 x y z 1 x’ y’ z’ 1 = The rotation R z (  ).

7 Example: Rotation about the z- axis Rotate 90  about the z-axis. What is the image of (3, 4, 5)? 000 1000 0010 0001 R z (90) = (3, 4, 5)  (-4, 3, 5)

8 3D Rotations about the x-axis 1000 0 cos  –sin  0 0 sin  cos  0 0001 x y z 1 x’ y’ z’ 1 = The rotation R x (  ).

9 Example: Rotation about the x- axis Rotate 90  about the x-axis. What is the image of (3, 4, 5)? (3, 4, 5)  (3, -5, 4) 1000 000 0100 0001 R x (90) =

10 3D Rotations about the y-axis cos  0 sin  0 0100 –sin  0 cos  0 0001 x y z 1 x’ y’ z’ 1 = The rotation R y (  ).

11 Example: Rotation about the y- axis Rotate 90  about the z-axis. What is the image of (3, 4, 5)? (3, 4, 5)  (5, 4, -3) 0010 0100 000 0001 R y (90) =

12 Direction of Rotation For each axis (x, y, z), the positive direction of rotation is determined by the right-hand rule. Point the thumb of your right hand in the positive direction of the axis. Curl your fingers. The direction of curl is the positive direction of rotation.

13 3D Transformations in OpenGL OpenGL uses the functions glTranslatef(dx, dy, dz) glRotatef(angle, vx, vy, vz)  v = (vx, vy, vz) is a vector indicating the axis of rotation. glScalef(sx, sy, sz)


Download ppt "Transformations in 3D Lecture 17 Mon, Oct 6, 2003."

Similar presentations


Ads by Google