3D Transformations
3D Transformations
3D Transformations
3D Transformations
From 2D to 3D
• Translation is simple as in 2D
• Use of Homogeneous coordinate in 3D
– In 3D transformation always use Matrix: 4x4
• All transformation in 3D is simple but only
Rotation transformation is complex in 3D
transformation.
3D Translation
Translate using (tx, ty, tz ): y
x' 1 0 0 t x x P
x
y' 0 1 0 t y y
z ' 0 0 1 t z z
z
1 0 0 0 1 1
3D Rotation 1
Rotate over angle around z - as :
x' x cos y sin
y ' x sin y cos z
y
z ' z P’
Or
P' R z ( )P, with P
cos sin 0 0 x
sin cos 0 0
R z ( )
0 0 1 0
0 0 0 1
2D Rotation about the origin.
x r. cos( ) r. cos . cos r. sin . sin
y y r. sin( ) r. cos . sin r. sin . cos
P’(x’,y’)
P(x,y)
r x r. cos
y r. sin
y
r
x
x
3D Rotation 2
z y z y z y
x x x
z x z x y
z y y z y
x y y z
y z z x
x x x
P1
z x
H&B 9-2:305-313
3D Rotation around arbitrary axis 3
y P2 y P2'
y
P1 P1' P1'
x x z x
z z ''
P
2
P1' P1' P1
z x x
''
P
2 z z x
3. rotate around 4. rotate back 5. translate back
z-axis
3D Rotation around arbitrary axis 3
y P2 y P2'
y
P1 T(P1) ' R
P' P
1
1
x x z x
z z ''
P
2
P1 T(P1) ' R
P' P
1
1
x x z x
z z ''
P
2