Upload
kateb
View
76
Download
2
Embed Size (px)
DESCRIPTION
3-D Geometric Transformations. Some of the material in these slides may have been adapted from the lecture notes of Graphics Lab @ Korea University. Contents. Translation Scaling Rotation Other Transformations Coordinate Transformations. Transformation in 3D. Transformation Matrix. - PowerPoint PPT Presentation
Citation preview
3-D GeometricTransformations
Some of the material in these slides may have been adapted from the lecture notes of Graphics Lab @ Korea University
2
Contents
● Translation● Scaling ● Rotation● Other Transformations● Coordinate Transformations
3
Transformation in 3D
● Transformation Matrix
1131
1333
000 SLIFCKHEBJGDA
33 : Scaling, Reflection, Shearing, Rotation31 : Translation
13 : Homogeneous representation11 : Uniform global Scaling
4
3D Translation
● Translation of a Point
zyx tzztyytxx ',','
11000100010001
1'''
zyx
ttt
zyx
z
y
x
xz
y
5
3D Scaling
● Uniform Scaling
zyx szzsyysxx ',','
11000000000000
1'''
zyx
ss
s
zyx
z
y
x
xz
y
6
Relative Scaling
● Scaling with a Selected Fixed Position
11000100010001
1000000000000
1000100010001
1'''
),,(),,(),,(zyx
zyx
ss
s
zyx
zyx
zyxTsssSzyxTf
f
f
z
y
x
f
f
f
fffzyxfff
x x x xzzzz
y y y y
Original position Translate Scaling Inverse Translate
7
3D Rotation
● Coordinate-Axes Rotations■ X-axis rotation■ Y-axis rotation■ Z-axis rotation
● General 3D Rotations■ Rotation about an axis that is parallel to one of the
coordinate axes■ Rotation about an arbitrary axis
8
Rotation is counterclockwise
9
Coordinate-Axes Rotations
Z-Axis Rotation ● X-Axis Rotation ● Y-Axis Rotation
11000010000cossin00sincos
1'''
zyx
zyx
z
y
x
110000cossin00sincos00001
1'''
zyx
zyx
110000cos0sin00100sin0cos
1'''
zyx
zyx
z
y
xz
y
x
10
11
3D line equation
● Given A (x0, y0, z0) and B (x1, y1, z1) forming a line.● The equation of this line can be formulated as follows:
ddn
zzyyxx
dcba
n
cba
tzyx
zyx
ˆ,010101
,
.000
12
Order of Rotations
● Order of Rotation Affects Final Position■ X-axis Z-axis
■ Z-axis X-axis
13
General 3D Rotations
● Rotation about an Axis that is Parallel to One of the Coordinate Axes■ Translate the object so that the rotation axis coincides
with the parallel coordinate axis■ Perform the specified rotation about that axis■ Translate the object so that the rotation axis is moved back
to its original position
14
Rotation about an arbitrary axis
15
General 3D Rotations
● Rotation about an Arbitrary Axis Basic Idea
1. Translate (x1, y1, z1) to the origin
2. Rotate (x’2, y’2, z’2) on to the z
axis3. Rotate the object around the z-axis
4. Rotate the axis to the original
orientation
5. Translate the rotation axis to the
original position
(x2,y2,z2)
(x1,y1,z1)
x
z
y
R-1
T-1
R
T
TRRRRRTR xyzyx111
16
General 3D Rotations
● Step 1. Translation
1000100010001
1
1
1
zyx
T
(x2,y2,z2)
(x1,y1,z1)
x
z
y
17
General 3D Rotations
● Step 2. Establish [ TR ]x x
axis
10000//00//00001
10000cossin00sincos00001
dcdbdbdc
x
R
(a,b,c)(0,b,c)
Projected Point
Rotated Point
dc
cb
cdb
cb
b
22
22
cos
sin
x
y
z22 cb
18
General 3D Rotations
● Step 2. Establish [ TR ]x x
axis
22 cb
(a,b,c)(0,b,c)
Projected Point
Rotated Point
dc
cb
cdb
cb
b
22
22
cos
sin
x
y
z
b
c
22 cb
a
222 cba
(a,b,c)(0,b,c)
(0,0,0)(0,0,0)
(0,b,c)
(0,0,c)
19
Arbitrary Axis Rotation
● Step 3. Rotate about y axis by
(a,b,c)
(a,0,d)
l
d
22
222222
cos,sin
cbd
dacballd
la
10000/0/00100/0/
10000cos0sin00100sin0cos
ldla
lald
y
Rx
y
Projected Point
zRotated
Point
a
(0,0,0)
(a,0,d)
d
(0,0,d)
l
20
Arbitrary Axis Rotation
● Step 4. Rotate about z axis by the desired angle
l
1000010000cossin00sincos
zR
y
x
z
21
Arbitrary Axis Rotation
● Step 5. Apply the reverse transformation to place the axis back in its initial position
x
y
l
l
z
10000cos0sin00100sin0cos
10000cossin00sincos00001
1000100010001
1
1
1
111
zyx
yx RRT
TRRRRRTR xyzyx111
22
Find the new coordinates of a unit cube 90º-rotated about an axis defined by its endpoints
A(2,1,0) and B(3,3,1).
A Unit Cube
Example
23
Example
● Step1. Translate point A to the origin
A’(0,0,0)x
z
y
B’(1,2,1)
1000010010102001
T
24
xz
y
l
1000
055
5520
05
52550
0001
xR
6121
55
51cos
552
52
12
2sin
222
22
lB’(1,2,1)
Projected point (0,2,1)
B”(1,0,5)
Example
● Step 2. Rotate axis A’B’ about the x axis by an angle , until it lies on the xz plane.
25
x
z
y
l
1000
06300
66
0010
0660
630
yR
630
65cos
66
61sin
B”(1,0, 5)(0,0,6)
Example
● Step 3. Rotate axis A’B’’ about the y axis by and angle , until it coincides with the z axis.
26
Example
● Step 4. Rotate the cube 90° about the z axis
■ Finally, the concatenated rotation matrix about the arbitrary axis AB becomes,
TRRRRRTR xyzyx 90111
1000010000010010
90zR
27
1000560.0167.0741.0650.0151.1075.0667.0742.0
742.1983.0075.0166.0
1000010010102001
1000
055
5520
05
52550
0001
1000
06300
66
0010
0660
630
1000010000010010
1000
06300
66
0010
0660
630
1000
055
5520
05
52550
0001
1000010010102001
R
Example
28
PRP
11111111076.0091.0560.0726.0817.0650.0301.1467.1483.0409.0151.1225.1184.0258.0484.0558.0
891.2909.1742.1725.2816.2834.1667.1650.2
11111111100110010000111111001100
1000560.0167.0741.0650.0151.1075.0667.0742.0
742.1983.0075.0166.0
P
Example
● Multiplying R(θ) by the point matrix of the original cube
29
Other Transformations
● Reflection Relative to the xy Plane
● Z-axis Shear
xz
y
x
z
y
11000010000100001
1zyx
zyx
'''
110000100010001
1'''
zyx
ba
zyx
30
Coordinate Transformations
● Multiple Coordinate System■ Local (modeling) coordinate system ■ World coordinate scene
Local Coordinate System
31
Coordinate Transformations
● Multiple Coordinate System■ Local (modeling) coordinate system ■ World coordinate scene
Word Coordinate System
32
Coordinate Transformations
● Example – Simulation of Tractor movement■ As tractor moves, tractor coordinate system and front-
wheel coordinate system move in world coordinate system
■ Front wheels rotate in wheel coordinate system
33
Coordinate Transformations
● Transformation of an Object Description from One Coordinate System to Another
● Transformation Matrix■ Bring the two coordinates systems into alignment1. Translation
x
y
z (0,0,0)
y’
z’
x’u'y
u'z
u'x(x0,y0,z0)x
y
z (0,0,0)
u'y
u'z
u'x
000 , , zyx T
34
Coordinate Transformations
2. Rotation & Scaling
x
y
z (0,0,0)
y’
z’
x’u'y
u'z
u'x x
y
z (0,0,0)
u'y
u'zu'x x
y
z (0,0,0)
u'y
u'zu'x
1000000
321
321
321
zzz
yyy
xxx
uuuuuuuuu
R