jinxiang chai composite transformations and forward kinematics 0
TRANSCRIPT
Jinxiang Chai
Composite Transformations and Forward Kinematics
1
Outline
2D Coordinate transformation
Composite transformation & Forward kinematics
3D transformation
2
Image space
Coordinate Transform: 3D Geometry Pipeline
3
Normalized project
space
View spaceWorld spaceObject space
Aspect ratio &
resolution
Focal length
Rotate and translate the
camera
Coordinate Transformation: 3D Modeling/Design
Coordinate transformation from one reference frame to another
4
Coordinate Transformation: Animation/Robotics
How to model 2D movement of animated characters or robots?
5
Click here
Coordinate Transformation
Coordinate transformation from one reference frame to another
6
Coordinate Transformation
Coordinate transformation from one reference frame to another
7
Coordinate Transformation
Coordinate transformation from one reference frame to another
8
Coordinate Transformation
Coordinate transformation from one reference frame to another
?
9
Review – Vector Operations
Dot Product
v w
10
Review – Vector Operations
Dot Product: measuring similarity between two vectors
v w
)cos(|||| wvwv
11
Review – Vector Operations
Dot Product: measuring similarity between two vectors
v w
)cos(|||| wvvw
12
Review – Vector Operations
Dot Product: measuring similarity between two vectors
v w
1vvUnit vector:
13
Review – Vector Operations
Dot Product: measuring similarity between two vectors
v w
)cos(|||| wvwv
14
Review – Vector Operations
Dot Product: measuring similarity between two vectors
v w
0wv
15
Review – Vector Operations
Cross Product: measuring the area determined by two vectors
16
v w
Review – Vector Operations
Cross Product: measuring the area determined by two vectors
sin 2*v w v w u area u
17
v w
u
2D Coordinates
2D Cartesian coordinate system:
P: (x,y)
i
j
o
18
2D Coordinate Transformation
2D Cartesian coordinate system:
P: (x,y)
i
j
o x
y1 ii
1 jj
0 ji
19
2D Coordinate Transformation
2D Cartesian coordinate system:
P: (x,y)
i
j
o x
y
1 ii
1 jj
0 ji
20
jyixop
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
21
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
22
Given the coordinates (x’,y’) in i’j’
- how to compute the coordinates (x,y) in ij?
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
23
Given the coordinates (x’,y’) in i’j’
- how to compute the coordinates (x,y) in ij?
0x
0y
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
),( 00 yx
24
Given the coordinates (x’,y’) in i’j’
- how to compute the coordinates (x,y) in ij?
1100
cossin
sincos
10
0
y
x
y
x
y
x
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
jyixop
ji ij
),( 00 yx
25
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
jyixop
jyixpo
ji ij
),( 00 yx
26
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
jyixop
jyixpo
jyixoo
00
ji ij
),( 00 yx
27
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
poooop
ji ij
),( 00 yx
28
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
poooop
jyixop
jyixpo
jyixoo
00
ji ij
),( 00 yx
29
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
poooop
ji ij
jyixjyixjyix
00
),( 00 yx
30
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
poooop
ji ij
jyixjyixjyix
00
jyixjyyixx
)()( 00
),( 00 yx
31
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
poooop
ji ij
jyixjyixjyix
00
jyixjyyixx
)()( 00
y
xji
yy
xxji
0
0),( 00 yx
32
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
y
xji
yy
xxji
0
0
),( 00 yx
33
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
y
xji
yy
xxji
0
0
y
xjiji
yy
xx 1
0
0
),( 00 yx
34
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
y
xji
yy
xxji
0
0
y
xjiji
yy
xx 1
0
0
y
xji
j
i
yy
xxT
T
0
0
),( 00 yx
35
10
01
jjij
jiii
j
iji
T
T
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
y
xji
j
i
yy
xxT
T
0
0
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
36
2D Coordinate Transformation
pj
i
i
j
o
o
ji ij
y
xji
j
i
yy
xxT
T
0
0
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
37
What does this column vector mean?
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
y
xji
j
i
yy
xxT
T
0
0
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
38
What does this column vector mean? Vector i’ in the new reference system
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
y
xji
j
i
yy
xxT
T
0
0
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
39
What does this column vector mean?
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
y
xji
j
i
yy
xxT
T
0
0
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
40
What does this column vector mean? Vector j’ in the new reference system
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
y
xji
j
i
yy
xxT
T
0
0
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
41
What does this column vector mean?
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
y
xji
j
i
yy
xxT
T
0
0
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
42
What does this column vector mean? The old origin in the new reference system
2D Coordinate Transformation
2D translation
pj
i
i
j
o
o
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
43
2D Coordinate Transformation
2D translation
pj
i
i
j
o
o
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
?
? ?
?
44
2D Coordinate Transformation
2D translation
pj
i
i
j
o
o
110010
0
y
x
yjjij
xjiii
y
xTT
TT
1
0
0
1
),( 00 yx
45
2D Coordinate Transformation
2D translation&rotation
pj
i
i
j
o
o
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
?
46
2D Coordinate Transformation
2D translation&rotation
pj
i
i
j
o
o
1100
cos
10
0
y
x
yjjij
xji
y
xTT
T
),( 00 yx
?
47
2D Coordinate Transformation
2D translation&rotation
pj
i
i
j
o
o
1100
sin
cos
10
0
y
x
yjj
xji
y
xT
T
),( 00 yx
48
2D Coordinate Transformation
2D translation&rotation
pj
i
i
j
o
o
1100
sin
cos
10
0
y
x
yjj
xji
y
xT
T
),( 00 yx
?
49
2D Coordinate Transformation
2D translation&rotation
pj
i
i
j
o
o
1100
sin
sincos
10
0
y
x
yjj
x
y
xT
),( 00 yx
50
2D Coordinate Transformation
2D translation&rotation
pj
i
i
j
o
o
1100
sin
sincos
10
0
y
x
yjj
x
y
xT
),( 00 yx
?
51
2D Coordinate Transformation
2D translation&rotation
pj
i
i
j
o
o
1100
cossin
sincos
10
0
y
x
y
x
y
x
),( 00 yx
52
2D Coordinate Transformation
An alternative way to look at the problem
i
j
o
pj
i
o ),( 00 yx
53
2D Coordinate Transformation
An alternative way to look at the problem
i
j
o
pj
i
o ),( 00 yx
54
),()( 00 yxTR
2D Coordinate Transformation
An alternative way to look at the problem
i
j
o
p
j
io ),( 00 yx
55
),()( 00 yxTR
2D Coordinate Transformation
An alternative way to look at the problem This transforms the point from (x,y) to (x’,y’)
i
j
o
p
j
io ),( 00 yx
56
1100
10
01
100
0cossin
0sincos
10
0
y
x
y
x
y
x
2D Coordinate Transformation
An alternative way to look at the problem This transforms the point from (x’,y’) to (x,y)
i
j
o
p
j
io ),( 00 yx
57
1100
0cossin
0sincos
100
10
01
1
11
0
0
y
x
y
x
y
x
2D Coordinate Transformation
An alternative way to look at the problem This transform the point from (x’,y’) to (x,y)
i
j
o
p
j
io ),( 00 yx
58
1100
0cossin
0sincos
100
10
01
1
11
0
0
y
x
y
x
y
x
2D Coordinate Transformation
An alternative way to look at the problem This transform the point from (x’,y’) to (x,y)
i
j
o
p
j
io ),( 00 yx
59
1100
0cossin
0sincos
100
10
01
1
11
0
0
y
x
y
x
y
x
100
10
01
0
0
y
x
2D Coordinate Transformation
An alternative way to look at the problem This transform the point from (x’,y’) to (x,y)
i
j
o
p
j
io ),( 00 yx
60
1100
0cossin
0sincos
100
10
01
1
11
0
0
y
x
y
x
y
x
100
10
01
0
0
y
x
2D Coordinate Transformation
An alternative way to look at the problem This transform the point from (x’,y’) to (x,y)
i
j
o
p
j
io ),( 00 yx
61
1100
0cossin
0sincos
100
10
01
1
11
0
0
y
x
y
x
y
x
100
10
01
0
0
y
x
100
0cossin
0sincos
2D Coordinate Transformation
Same results!
pj
i
i
j
o
o
1100
cossin
sincos
10
0
y
x
y
x
y
x
),( 00 yx
62
2D Coordinate Transformation
2D translation&rotation
pj
i
i
j
o o
1???
???
???
1
y
x
y
x
30
63
2D Coordinate Transformation
2D translation&rotation
pj
i
i
j
o o
1100
030cos30sin
030sin30cos
1
y
x
y
x
30
64
2D Coordinate Transformation
2D translation&rotation
p
j
i
i
j
oo
1???
???
???
1
y
x
y
x
45
65
2D Coordinate Transformation
2D translation&rotation
p
j
i
i
j
oo
1100
045cos45sin
045sin45cos
1
y
x
y
x
45
66
2D Coordinate Transformation
2D translation&rotation
p
j
i
i
j
o
)2,4( o
1???
???
???
1
y
x
y
x
45
67
2D Coordinate Transformation
2D translation & rotation
p
j
i
i
j
o
)2,4( o
1100
245cos45sin
445sin45cos
1
y
x
y
x
45
68
Composite 2D Transformation
How to model 2D movement of characters or robots?
69
Click here
Composite 2D Transformation
A 2D lamp character
1
2
3
),,( 0yx
3c
2c
1c
0c
A
70
0
Composite 2D Transformation
A 2D lamp character3l
A2l
1l
0l
71
Composite 2D Transformation
How can we draw the character given the pose ?
1
2
3
),,( 0yx
3c
2c
1c
0c
A
72
),,,,,( 3210 yx
),,( 0yx
3c2c
0c
A1c
Articulated Character
A default pose (0,0,0,0,0,0)
Composite 2D Transformation
What’s the pose?
)1,5(
74
?)?,?,?,,1,5(
300
Composite 2D Transformation
What’s the pose?
)1,5(
75
)90,0,90,30,1,5(
300
Composite 2D Transformation
A 2D lamp character
1
2
3
3c
2c
1c
A
Given , and the local coordinates of point A, how to compute the global coordinates of point A?
),,,,,( 3210 yx
?
),,( 0yx0c
76
Composite 2D Transformation
What’s local coordinate ?
1
2
3
3c
2c
1c
A
?
A
),,( 0yx0c
77
Composite 2D Transformation
What’s local coordinate ?
1
2
3
3c
2c
1c
A
?
A
1
03
0
l
p
),,( 0yx0c
03221100 )()0,()()0,()()0,()(),( pRlTRlTRlTRyxTp 78
Composite 2D Transformation
What’s the current coordinate A ?
1
2
3
3c
2c
1c
A
?
),,( 0yx0c
1
00
l
p
03221100 )()0,()()0,()()0,()(),( pRlTRlTRlTRyxTp
100
010
01
)0,(2
2
l
lT
79
100
0cossin
0sincos
)( 33
33
3
R
Composite 2D Transformation
What’s the current coordinate A ?
1
2
3
3c
2c
1c
A
?
),,( 0yx0c
1
00
l
p
03221100 )()0,()()0,()()0,()(),( pRlTRlTRlTRyxTp
100
010
01
)0,(1
1
l
lT
80
100
0cossin
0sincos
)( 22
22
2
R
Composite 2D Transformation
What’s the current coordinate A ?
1
2
3
3c
2c
1c
A
?
),,( 0yx0c
1
00
l
p
03221100 )()0,()()0,()(),0()(),( pRlTRlTRlTRyxTp
100
10
001
),0( 00 llT
81
100
0cossin
0sincos
)( 11
11
1
R
Composite 2D Transformation
What’s the current coordinate A ?
1
2
3
3c
2c
1c
A
?
03221100 )()0,()()0,()(),0()(),( pRlTRlTRlTRyxTp
),,( 0yx0c
1
00
l
p
100
cossin
sincos
)(),( 00
00
0 y
x
RyxT
82
Composite 2D Transformation
What’s the current coordinate A ?
1
2
3
3c
2c
1c
A
03221100 )()0,()()0,()(),0()(),( pRlTRlTRlTRyxTp
),,( 0yx0c
83
Composite 2D Transformation
What’s the pose?
)1,5(
84
)90,0,90,30,1,5(
300
l0=1, l1=7, l2=6, l3=6
)90()0,6()0()0,7()90()1,0()30()1,5( RTRTRTRTp 0p
Composite 2D Transformation
What’s the pose?
)1,5(
85
)90,0,90,30,1,5(
300
l0=1, l1=7, l2=6, l3=6
)90()0,6()0()0,7()90()1,0()30()1,5( RTRTRTRTp 0p
How about this point?
How to Animate the Character?
A 2D lamp character
1
2
3
),,( 0yx
3c
2c
1c
0c
A
86
How to Animate the Character?
Keyframe animation
- Manually pose the character by choosing appropriate values for
- Linearly interpolate the inbetween poses.
- Works for any types of articulated characters!
87
),,,,,( 3210 yx
How to Animate the Character?
Keyframe animation
Motion capture
- motion interpolations, graph based, statistics-based,
88
How to Animate the Character?
Keyframe animation
Motion capture
- motion interpolations, graph based, statistics-based, Physically based animation - needs to solve extremely complex equations
- usually very slow
- human motion might look robotic
89
3D Transformation
A 3D point (x,y,z) – x,y, and z coordinates We will still use column vectors to represent
points Homogeneous coordinates of a 3D point
(x,y,z,1) Transformation will be performed using 4x4
matrix
x
y
z
90
Right-handed Coordinate System
x
y
z
;zyx ;xzy yxz
Left hand coordinate system
Not used in this class and
Not in OpenGL 91/94
3D Transformation
Very similar to 2D transformation
Translation transformation
11000
100
010
001
1
z
y
x
t
t
t
z
y
x
x
y
x
Homogenous coordinates
92
3D Transformation
Very similar to 2D transformation
Scaling transformation
11000
000
000
000
1
z
y
x
s
s
s
z
y
x
z
y
x
Homogenous coordinates
93
3D Transformation
3D rotation is done around a rotation axis Fundamental rotations – rotate about x, y, or
z axes Counter-clockwise rotation is referred to as
positive rotation (when you look down negative axis)
x
y
z
+
94
3D Transformation
Rotation about z – similar to 2D rotation
x
y
z
+
11000
0100
00cossin
00sincos
1
z
y
x
z
y
x
zz
yxy
yxx
'
cossin'
sincos'
95
3D Transformation
Rotation about y: z -> y, y -> x, x->z
x
y
z
11000
0cos0sin
0010
0sin0cos
1
z
y
x
z
y
x
yy
xzx
xzz
'
cossin'
sincos'
y
z
x
96
3D Transformation
Rotation about x (z -> x, y -> z, x->y)
x
y
z
11000
0cossin0
0sincos0
0001
1
z
y
x
z
y
x
xx
zyz
zyy
'
cossin'
sincos'
z
x
y
97
3D Rotation about Arbitrary Axes
Rotate p about the by the angle
x
y
zr
),,( zyxp
r
98
3-D Rotation General rotations in 3-D require rotating
about an arbitrary axis of rotation
Deriving the rotation matrix for such a rotation directly is a good exercise in linear algebra
99
3D Rotation about Arbitrary Axes
Rotate p about the by the angle
x
y
zr
),,( zyxp
r
100
3-D Rotation General rotations in 3-D require rotating about
an arbitrary axis of rotation
Deriving the rotation matrix for such a rotation directly is a good exercise in linear algebra
Standard approach: express general rotation as composition of canonical rotations Rotations about x, y, z
101
Composing Canonical Rotations Goal: rotate about arbitrary vector r by θ
Idea: we know how to rotate about x,y,zSo, rotate about z by - until r lies in the xz
planeThen rotate about y by -β until r coincides
with +zThen rotate about z by θThen reverse the rotation about y (by β )Then reverse the rotation about z (by )
102
3D Rotation about Arbitrary Axes
Rotate p about the by the angle
x
y
zr
),,( zyxp
r
103
3D Rotation about Arbitrary Axes
Translate so that rotation axis passes through the origin
x
y
zr
TRRRRRT zyzyz )()()()()(1
104
3D Rotation about Arbitrary Axes
Rotation by about z-axis
x
y
z
r
TRRRRRT zyzyy )()()()()(1
105
3D Rotation about Arbitrary Axes
Rotation by about y-axis
x
y
z
r
xTRRRRRT zyzyy )()()()()(1
106
3D Rotation about Arbitrary Axes
Rotation by about z-axis
x
y
z
r
xTRRRRRT zyzyy )()()()()(1
107
3D Rotation about Arbitrary Axes
Rotation by about y-axis
x
y
z
r
xTRRRRRT zyzyy )()()()()(1
108
3D Rotation about Arbitrary Axes
Rotation by about z-axis
x
y
z
r
TRRRRRT zyzyz )()()()()(1
109
3D Rotation about Arbitrary Axes
Translate the object back to original point
x
y
z
r
TRRRRRT zyzyz )()()()()(1
110
3D Rotation about Arbitrary Axes
Final transformation matrix for rotating about an arbitrary axis
x
y
z
r
TRRRRRT zyzyz )()()()()(1
111
3D Rotation about Arbitrary Axes
Final transformation matrix for rotating about an arbitrary axis
x
y
z
r
TRRRRRT zyzyz )()()()()(1
112
3D Rotation about Arbitrary Axes
Final transformation matrix for rotating about an arbitrary axis
TRRRRRT zyzyz )()()()()(1
1000
0
0
0
333231
232221
131211
rrr
rrr
rrr
3D Rotation about Arbitrary Axes
Final transformation matrix for rotating about an arbitrary axis
TRRRRRT zyzyz )()()()()(1
A 3 by 3 Rotation matrix
1000
0
0
0
333231
232221
131211
rrr
rrr
rrr
Rotation Matrices
Orthonormal matrix: orthogonal (columns/rows linearly
independent)normalized (columns/rows length of 1)
115
Rotation Matrices
Orthonormal matrix: orthogonal (columns/rows linearly
independent)normalized (columns/rows length of 1)
The inverse of an orthogonal matrix is just its transpose:
116
T
rrr
rrr
rrr
rrr
rrr
rrr
333231
232221
131211
1
333231
232221
131211
Rotation Matrices
Orthonormal matrix: orthogonal (columns/rows linearly
independent)normalized (columns/rows length of 1)
The inverse of an orthogonal matrix is just its transpose:
117
T
rrr
rrr
rrr
rrr
rrr
rrr
333231
232221
131211
1
333231
232221
131211
Rotation Matrices
Orthonormal matrix: orthogonal (columns/rows linearly
independent)normalized (columns/rows length of 1)
The inverse of an orthogonal matrix is just its transpose:
118
T
rrr
rrr
rrr
rrr
rrr
rrr
333231
232221
131211
1
333231
232221
1312111r
2r
3r
Why?
Rotation Matrices
119
332313
322212
312111
331
1
1
1
3
2
1
3
2
1
rrrrrr
rrrrrr
rrrrrr
rrr
r
r
r
r
r
r
r
r
r
TTT
T
Why?
Rotation Matrices
120
332313
322212
312111
331
1
1
1
3
2
1
3
2
1
rrrrrr
rrrrrr
rrrrrr
rrr
r
r
r
r
r
r
r
r
r
TTT
T
Why?
Rotation Matrices
121
332313
322212
312111
331
1
1
1
3
2
1
3
2
1
rrrrrr
rrrrrr
rrrrrr
rrr
r
r
r
r
r
r
r
r
r
TTT
T
Why?
Rotation Matrices
122
100
010
001
331
1
1
1
3
2
1
3
2
1
TTT
T
rrr
r
r
r
r
r
r
r
r
r
Rotation Matrices
Orthonormal matrix: orthogonal (columns/rows linearly
independent)normalized (columns/rows length of 1)
The inverse of an orthogonal matrix is just its transpose: e.g.,
T
xx
Tyy
Tzz
RR
RR
RR
)()(
)()(
)()(
1
1
1
123
3D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
),,( 000 zyx
k
'k
124
2D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
110010
0
y
x
yjjij
xjiii
y
xTT
TT
),( 00 yx
poooop
125
3D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
1
'
'
'
1000
'
'
'
10
0
0
z
y
x
zkkjkik
ykjjjij
xkijiii
z
y
x
TTT
TTT
TTT
),,( 000 zyx
k
'k
poooop
126
3D Coordinate Transformation
Transform object description from to
pj
i
i
j
o
o
ji ij
1
'
'
'
1000
'
'
'
10
0
0
z
y
x
zkkjkik
ykjjjij
xkijiii
z
y
x
TTT
TTT
TTT
),,( 000 zyx
k
'k
poooop
127
3D Coordinate Transformation
Transform object description from to
i
i
j
o
ji ij
1
'
'
'
1000
'
'
'
10
0
0
z
y
x
zkkjkik
ykjjjij
xkijiii
z
y
x
TTT
TTT
TTT
k
128
p'i
'j
3D Coordinate Transformation
Transform object description from to
i
j
o
ji ij
k
129
p'i
'j
1
'
'
'
1000
0100
00cossin
00sincos
1
z
y
x
z
y
x
Composite 3D Transformation
Similarly, we can easily extend composite transformation from 2D to 3D
1
2
3
),,( 0yx
3c
2c
1c
0c
A
130
Composite 3D Transformation
xRRhTRhTRRRhTRRRzyxTp )()()0,,0()()0,,0()()()()0,,0()()()(),,( 332211110000000
131