Lect 9
Lect 9
(Lecture 9)
3D Translation
Translation by (tx, ty, tz) is achieved using the following matrix:
1 0 0 tx
0 1 0 ty
M T (t x , t y , t z )
0 0 1 tz
0 0 0 1
Y -z
-x
(2,0,-4)
(4,0,-2)
-y
Z
Scaling with respect to a selected point
Solution:
1: Translate the object to system origin by T(-2,0,4)
2: Scale the object by S (2,1,0.5)
3:Translate the object back to (2,0,-4) by T (2,0,-4)
p’ = T-1.S.T .p
transformation
Scaling with respect to a selected point
Y -z Y -z
Y -z
-x -x
-x
-y -y -y
Z Z Z
𝑥′ 1 0 0 2 2 0 0 −4 𝑥
𝑦′ 0 1 0 0 0 1 0 0 𝑦
=
𝑧′ 0 0 1 −4 0 0 0.5 2 𝑧
1 0 0 0 1 0 0 0 1 1
𝑥′ 2 0 0 −2 𝑥
𝑦′ 0 1 0 0 𝑦
=
𝑧′ 0 0 0.5 −2 𝑧
1 0 0 0 1 1
3D Rotation
1 0 0 0
cos sin 0
• About X axis (Pitch angle) R x 0 (x,y,z)
0 sin cos 0
x
0 0 0 1
(x’,y’,z’)
cos 0 sin 0
0 0
• About Y axis (Yaw angle) Ry
1 0
(x,y,z)
sin 0 cos 0 (x’,y’,z’)
0 0 0 1
cos sin 0 0
(x,y,z)
sin cos 0
• About Z axis (Roll angle) Rz
0
x
0 0 1 0
(x’,y’,z’)
0 0 0 1
Major Axis Rotation
Exercise - Rotate by 45 about x axis
To rotate by 45 degrees about x-axis, use the following matrix:
1 0 0 0
1 0 0 0 1 1
0 0 0
cos 45 sin 45 0
R x ( 45)
2 2
0 sin 45 cos 45 0 0 1 1
0
2 2
0 0 0 1
1
0 0 0
3D Shear - One axe
𝒙′ 𝟏 𝒔𝒉𝒙𝒚 𝒔𝒉𝒙𝒛 𝟎 𝒙
• X-shearing a point 𝒚′ 𝟎 𝟏 𝟎 𝟎 𝒚
=
𝒛′ 𝟎 𝟎 𝟏 𝟎 𝒛
𝟏 𝟎 𝟎 𝟎 𝟏 𝟏
𝒙′ 𝟏 𝟎 𝟎 𝟎 𝒙
• Y-shearing a point 𝒚′ 𝒔𝒉𝒚𝒙 𝟏 𝒔𝒉𝒚𝒛 𝟎 𝒚
=
𝒛′ 𝟎 𝟎 𝟏 𝟎 𝒛
𝟏 𝟎 𝟎 𝟎 𝟏 𝟏
• Z-shearing a point 𝒙′ 𝟏 𝟎 𝟎 𝟎 𝒙
𝒚′ 𝟎 𝟏 𝟎 𝟎 𝒚
=
𝒛′ 𝒔𝒉𝒛𝒙 𝒔𝒉𝒛𝒚 𝟏 𝟎 𝒛
𝟏 𝟎 𝟎 𝟎 𝟏 𝟏
3D Shear - Two axis
• XY-shearing a point (Z is fixed)
𝒙′ 𝟏 𝟎 𝒔𝒉𝒛𝒙 𝟎 𝒙
𝒚′ 𝟎 𝟏 𝒔𝒉𝒛𝒚 𝟎 𝒚
=
𝒛′ 𝟎 𝟎 𝟏 𝟎 𝒛
𝟏 𝟎 𝟎 𝟎 𝟏 𝟏
𝒙′ 𝟏 𝟎 𝟎 𝟎 𝒙
𝒚′ 𝒔𝒉𝒙𝒚 𝟏 𝟎 𝟎 𝒚
=
𝒛′ 𝒔𝒉𝒙𝒛 𝟎 𝟏 𝟎 𝒛
𝟏 𝟎 𝟎 𝟎 𝟏 𝟏
3D Shear - All together
𝒙′ 𝟏 𝒔𝒉𝒙𝒚 𝒔𝒉𝒙𝒛 𝟎 𝒙
𝒚′ 𝒔𝒉𝒚𝒙 𝟏 𝒔𝒉𝒚𝒛 𝟎 𝒚
=
𝒛′ 𝒔𝒉𝒛𝒙 𝒔𝒉𝒛𝒚 𝟏 𝟎 𝒛
𝟏 𝟎 𝟎 𝟎 𝟏 𝟏
Example
We want to Rotate a Line around a point with a specific Angle :
VPN
F B