View
214
Download
0
Embed Size (px)
Citation preview
Lecture 13Operations in Graphics and Geometric
Modeling I:
Projection, Rotation, and Reflection
Shang-Hua Teng
Projection Matrix: on to a Line
b
a
aaa
ba
aa
aba
a
abp
T
T
T
coscos
p
What matrix P has the propertyp = Pb
aa
aaP
baa
aa
aa
baap
Pbaaa
bap
T
T
T
T
T
T
T
T
Properties of Projection on to a Lineb
a
p
xab
xapaa
baxbax
x
apb
ap
T
T
ˆ
minimizes which ,ˆ
ˆ then ,
ofion approximat
squareleast theis ˆ if
)(
)(Span
p is the points in Span(a) that is the closest to b
Projection onto a Subspace
• Input: 1. Given a vector subspace V in Rm
2. A vector b in Rm…
• Desirable Output:– A vector in p in V that is closest to b– The projection p of b in V– A vector p in V such that (b-p) is orthogonal
to V
How to Describe a Vector Subspace V in Rm
• If dim(V) = n, then V has n basis vectors– a1, a2, …, an
– They are independent
• V = C(A) where A = [a1, a2, …, an]
Projection onto a Subspace
• Input: 1. Given n independent vectors a1, a2, …, an in Rm
2. A vector b in Rm…
• Desirable Output:– A vector in p in C([a1, a2, …, an]) that is closest to b
– The projection p of b in C([a1, a2, …, an])
– A vector p in V such that (b-p) is orthogonal to
C([a1, a2, …, an])
Using Orthogonal Condition
TT
TT
TT
T
AAAAP
bAAAAxAp
bAAAx
xAbA
xAb
ACxAbx
1
1
1
)( ismatrix projection The
)(ˆSet
)(ˆthen
0ˆ
meaning nullspace,left in the is ˆ
)(ˆ such that ˆ Find
Connection to Least Square Approximation
TT
TT
TT
AAAAP
bAAAAxAp
xAbx
bAAAx
bx
x
1
1
1
)( ismatrix projection The
)(ˆSet
ˆ minimizes ˆ that Note
)(ˆthen
A
toˆsolution squareleast theFind
Properties of The Rotation Matrix
0
1
cos
sin,
sin
cos
cossin
sincos
21
21
21
21
qqQ
T
Q is an orthonormal matrix: QT Q = I
Rotation Matrix in High Dimensions
100
0cossin
0sincos
cos0sin
010
sin0cos
,
cossin0
sincos0
001
12
1323
Q
Q is an orthonormal matrix: QT Q = I
Reflection is Symmetric and Orthonormal
buuT2
buuTu
b
mirror
IuuuuuuIuuIuuIRR
RuuIuuIRTTTTTT
TTTT
4422
22
Orthonormal Vectors
ors)(unit vect j i when 1
vectors)l(orthogona j i when 0
,,1
jT
i
n
qq are orthonormal if
Orthonormal Matrices
Q is orthonormal if QT Q = I
The columns of Q are orthonormal vectors
Theorem: For any vectors x and y,
xQx
yxQyQxQyQx TTTT
Products of Orthonormal Matrices
Theorem: If Q and P are both orthonormal matrices then
QP is also an orthonormal matrix.
Proof:
IPPQPQPQPQP TTTT
Orthonormal Basis and Gram-Schmidt
• Input: an m by n matrix A
• Desirable output: Q such that – C(A) = C(Q), and – Q is orthonormal
Basic Idea• Suppose A = [a1 … an]
• If n = 1, then Q = [a1 /|| a1 ||]
• If n = 2, – q1 = a1 /|| a1 ||
– Start with a2 and subtract its projection along a1
– Normalize
222
1
11
2122
ˆ/ˆ
ˆ
qqq
aaa
aaaq T
T
Gram-Schmidt
• Suppose A = [a1 … an]
– q1 = a1 /|| a1 ||
– For i = 2 to n
][ 1 nqqQ
iii
i
jji
Tji
i
jj
jT
j
iT
jii
qqq
qaqaaaa
aaaq
ˆ/ˆ
ˆ1
1
1
1
What is the complexity? O(mn2)
Theorem: QR-Decomposition
• Suppose A = [a1 … an]– There exist an upper triangular matrix R such that
– A = QR
nT
n
nTT
nTTT
nT
nT
nT
n
nTTT
nTTT
nT
nT
aq
aqaq
aqaqaq
aqaqaq
aqaqaq
aqaqaq
aaqqAQ
00
0
][][
222
12111
21
22212
12111
11