Class 01 Transformations
Class 01 Transformations
Class 01 Transformations
*** All the Transformations (Translation, Rotation, Reflection, Scaling) are 3D. +z
-y
*** Extra column is required to perform Addition
by Multiplication.
tx
ty
x′ 0 –1 0 x
y′ = 1 0 0 y
1 0 0 1 1
12
Thus the point (1, 0, 0) becomes (0, 1, 0).
Rotation in –ve angle
In the Figure the point P(x, y, z) is to be rotated by an angle - about the origin
to P(x′, y′, z′). It can be seen that:
x′ = r cos(θ – )
y′ = r sin(θ – ) P(x,y,z)
x′ cos sin 0 x
y′ = –sin cos 0 y
1 0 0 1 1
z′ z
1 1
(-t matrix)
x′ 1 0 0 px cos –sin 0 0 1 0 0 -px x
z′ 0 0 1 pz 0 0 1 1 0 0 1 -pz z
1 0 0 0 1 0 0 0 1 0 0 0 1 1
15
Coordinate Transformation (Rotation in 3D)
In computer graphics multiplication of 3matrix is used as one matrix.
in matrix form: Center of rotation in not-origin.
16
Coordinate Transformation (Rotation in 3D), alternate solution
To rotate a point (x, y, z) about an arbitrary center of rotation (px, py, pz)
1. Subtract (px, py, pz) from the coordinates (x, y, z) respectively. This enables us to perform
the rotation about the origin. Question:
x1 = (x – px) A 3D point is rotating across z-axis.
and center of rotation is (Px, Py, Pz),
y1 = (y – py) then derive 4-4 Matrix.
z1 = (z – pz)
2. Rotate about the origin:
x2 = (x –px) cos – (y –py) sin
y2 = (x –px) sin + (y –py) cos
z2 = (z – pz)
3. Add (px, py, pz) to compensate for the original subtraction
x′= (x – px) cos – (y – py) sin + px
y′= (x – px) sin + (y – py) cos + py
z′= (z – pz) + pz 17
Rotation in 3D x′= x cos –y sin + px(1 –cos ) + py sin
y′= x sin + y cos + py(1 –cos ) –px sin
z′= z
in matrix form:
x′ cos –sin 0 px(1–cos ) + py sin x
y′ = sin cos 0 py(1–cos ) – px sin y
z′ 0 0 1 0 z
1 0 0 0 1 1
rotating a point 90º about the point (1, 1, 0) the matrix becomes
x′ 0 –1 0 2 x
y′ = 1 0 0 0 y
z′ 0 0 1 0 z
1 0 0 0 1 1 18
Example: Coordinate Transformation (Rotation in 3D) V.V.I.
Determine the new coordinate P′ of a point P(120, 30, 80) after rotating 300 across Z-axis.
Assume that the center of rotation is C(30, -40, 50).
Solution:
Subrtract C(30, -40, 50) from P(120, 30, 80) to get P1. This enables us to perform the
rotation about the origin.
x1 = 120 – 30 = 90
y1 = 30 – (-40) = 70
z1 = 80 – 50 = 30
Rotate P1 , 300 about the origin across Z-axis to get P2 :
x2 = 90 cos 300 – 70 sin 300 = 42.94
y2 = 90 sin 300 + 70 cos 300 = 105.62
z2 = 30
Add C(30, -40, 50) to to get P′ (compensate for the original subtraction)
x′= 42.94 + 30 = 72.94
y′= 105.62 + (-40) = 65.62
z′= 30 + 50 = 80 Ans. 19
Multiple Rotations in 3D
• Product of 3 consecutive rotations (e.g., around X-Y-Z axes)
• Roll-pitch-yaw convention is very common in aerial navigation
Rotation across X-axis = ROLL
Rotation across Y-axis = PITCH
Rotation across Z-axis = YAW
+z
21
Multiple rotation in co-ordinate transformation
Roll , Pitch , Yaw , and center of rotation is (a, b, c)
Conversion to 44 rotation matrix: R = T · Rz() · Ry() · Rx() · -T
rotation across z-axis rotation across y-axis
rotation across x-axis
x' 1 0 0 a Cos –Sin 0 0 Cos 0 Sin 0 1 0 0 0 1 0 0 –a x
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1
line of reflection
If you folded the two shapes together the two shapes would overlap exactly!
What happens to points in a Reflection?
• Name the points of the original triangle.
A (2,-3) B (5,-4) C (2,-4)
• Name the points of the reflected triangle.
A' (2,3) B' (5,4) C' (2,4)
• What is the line of reflection? x-axis