CT4201/EC4215: Computer Graphics
TransformationBOCHANG MOON
Transformation• Fundamental operation to arrange objects in a 3D scene
Object 3D scene
Transformation: Scaling• Change length along the coordinate axes
◦ 𝑠𝑐𝑎𝑙𝑒 𝑠 , 𝑠𝑠 00 𝑠
◦𝑠 00 𝑠
𝑥𝑦
𝑠 𝑥𝑠 𝑦
x
y
x
y
0.5 00 0.5
Transformation: Scaling• Change length along the coordinate axes
◦ 𝑠𝑐𝑎𝑙𝑒 𝑠 , 𝑠𝑠 00 𝑠
◦𝑠 00 𝑠
𝑥𝑦
𝑠 𝑥𝑠 𝑦
x
y
x
y
0.5 00 2.0
Transformation: Shearing• Push objects sideways along horizontal or vertical direction◦ 𝑠ℎ𝑒𝑎𝑟 𝑠 1 𝑠
0 1◦ 𝑠ℎ𝑒𝑎𝑟 𝑠 1 0
𝑠 1
x
y
x
y
1 10 1
Transformation: Shearing• Push objects sideways along horizontal or vertical direction◦ 𝑠ℎ𝑒𝑎𝑟 𝑠 1 𝑠
0 1◦ 𝑠ℎ𝑒𝑎𝑟 𝑠 1 0
𝑠 1
x
y
x
y
1 01 1
Transformation: Rotation• Rotate objects counterclockwise◦ 𝑟𝑜𝑡𝑎𝑡𝑒 𝜃 𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃
𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃
x
y
x
y
𝑐𝑜𝑠𝜋4 𝑠𝑖𝑛
𝜋4
𝑠𝑖𝑛𝜋4 𝑐𝑜𝑠
𝜋4
45 degrees
Transformation: Rotation• Rotate objects counterclockwise◦ 𝑟𝑜𝑡𝑎𝑡𝑒 𝜃 𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃
𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃
x
y
x
y
𝑐𝑜𝑠𝜋
4 𝑠𝑖𝑛𝜋
4𝑠𝑖𝑛
𝜋4 𝑐𝑜𝑠
𝜋4
‐45 degrees
Transformation: Reflection• Reflect objects across either of the coordinate axes◦ 𝑟𝑒𝑓𝑙𝑒𝑐𝑡_𝑦 1 0
0 1
x
y
x
y
Transformation: Reflection• Reflect objects across either of the coordinate axes◦ 𝑟𝑒𝑓𝑙𝑒𝑐𝑡_𝑥 1 0
0 1
x
y
x
y
Transformation: Composition• Apply more than one transformation to an object
• e.g. apply a scale S, and then a rotation R◦
𝑥𝑦 𝑅𝑆
𝑥𝑦
x
y
x
y
Transformation: Composition• Apply more than one transformation to an object
• e.g. apply a scale S, and then a rotation R◦
𝑥𝑦 𝑆
𝑥𝑦
x
y
x
y
Transformation: Composition• Apply more than one transformation to an object
• e.g. apply a scale S, and then a rotation R◦
𝑥𝑦 𝑅
𝑥𝑦
x
y
x
y
Inverse Transformation• Your transformation◦ 𝑥 𝑅𝑆𝑥 𝑇𝑥
• Undo your transformation◦ 𝑥 𝑇 𝑥
x
y
x
y
Inverse Transformation• Your transformation◦ 𝑥 𝑅𝑆𝑥 𝑇𝑥
• Undo your transformation◦ 𝑥 𝑇 𝑥 𝑅𝑆 𝑥 𝑆 𝑅 𝑥
x
y
x
y
Inverse Transformation• Your transformation◦ 𝑥 𝑅𝑆𝑥 𝑇𝑥
• Undo your transformation◦ 𝑥 𝑇 𝑥 𝑅𝑆 𝑥 𝑆 𝑅 𝑥
x
y
x
y
𝑅
Inverse Transformation• Your transformation◦ 𝑥 𝑅𝑆𝑥 𝑇𝑥
• Undo your transformation◦ 𝑥 𝑇 𝑥 𝑅𝑆 𝑥 𝑆 𝑅 𝑥
x
y
x
y
𝑆
Inverse Matrix• M = 2 x 2 matrix
◦ 𝑀 𝑀 𝑀𝑀 𝑀
◦ 𝑀 𝑀 𝑀𝑀 𝑀