1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated:...
-
Upload
nehemiah-roberson -
Category
Documents
-
view
215 -
download
1
Transcript of 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated:...
![Page 1: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/1.jpg)
1
Linear Algebra(Mathematics for CG)
Reading: HB Appendix A
Computer Graphics
Last Updated: 13-Jan-12
![Page 2: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/2.jpg)
2
Notation: Scalars, Vectors, Matrices
Scalar(lower case, italic)
Vector(lower case, bold)
Matrix(upper case, bold)
aa
naaa ...21a
333231
232221
131211
aaa
aaa
aaa
A
![Page 3: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/3.jpg)
3
Vectors
Arrow: Length and DirectionOriented segment in 2D or 3D space
![Page 4: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/4.jpg)
4
Column vs. Row Vectors
Row vectors
Column vectors
Switch back and forth with transpose
n
col
a
a
a
...2
1
a
rowTcol aa
nrow aaa ...21a
![Page 5: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/5.jpg)
5
Vector-Vector Addition
Add: vector + vector = vector
Parallelogram ruletail to head, complete the triangle
33
22
11
vu
vu
vu
vu
)0,6,5()1,1,3()1,5,2(
)6,9()4,6()2,3(
vu
u
v
geometric algebraic
examples:
![Page 6: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/6.jpg)
6
Vector-Vector Subtraction
Subtract: vector - vector = vector
33
22
11
vu
vu
vu
vu
)2,4,1()1,1,3()1,5,2(
)2,3()4,6()2,3(
vu
u
v
v
)( vu
![Page 7: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/7.jpg)
7
Vector-Vector Subtraction
Subtract: vector - vector = vector
33
22
11
vu
vu
vu
vu
)2,4,1()1,1,3()1,5,2(
)2,3()4,6()2,3(
vu
u
v
v
)( vu
vu v
u uv v
uargument reversal
![Page 8: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/8.jpg)
8
Scalar-Vector Multiplication
Multiply: scalar * vector = vectorvector is scaled
)*,*,*(* 321 uauauaa u
)5,.5.2,1()1,5,2(*5.
)4,6()2,3(*2
u*a
u
![Page 9: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/9.jpg)
9
Vector-Vector Multiplication
Multiply: vector * vector = scalar
Dot product or Inner product vu
332211
3
2
1
3
2
1
vuvuvu
v
v
v
u
u
u
![Page 10: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/10.jpg)
10
Vector-Vector Multiplication
Multiply: vector * vector = scalar
dot product, aka inner product vu
332211
3
2
1
3
2
1
vuvuvu
v
v
v
u
u
u
332211
3
2
1
3
2
1
vuvuvu
v
v
v
u
u
u
![Page 11: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/11.jpg)
11
Vector-Vector Multiplication
Multiply: vector * vector = scalar
dot product or inner product
332211
3
2
1
3
2
1
vuvuvu
v
v
v
u
u
u
vu
cosvuvu
u
v
• geometric interpretation• lengths, angles• can find angle between two
vectors
![Page 12: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/12.jpg)
12
Dot Product Geometry
Can find length of projection of u onto v
as lines become perpendicular,
cosvuvu u
v
cosu
0 vu
v
vuu
cos
![Page 13: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/13.jpg)
13
Dot Product Example
19676)3*2()7*1()1*6(
3
7
1
2
1
6
332111
3
2
1
3
2
1
vuvuvu
v
v
v
u
u
u
![Page 14: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/14.jpg)
14
Vector-Vector Multiplication
Multiply: vector * vector = vector
cross product
1221
3113
2332
3
2
1
3
2
1
vuvu
vuvu
vuvu
v
v
v
u
u
u
![Page 15: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/15.jpg)
15
Vector-Vector Multiplication
multiply: vector * vector = vector
cross product
algebraic
geometric
parallelogram area
perpendicular to parallelogram
1221
3113
2332
3
2
1
3
2
1
vuvu
vuvu
vuvu
v
v
v
u
u
u
ba
ba
sinvuba
![Page 16: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/16.jpg)
16
RHS vs. LHS Coordinate Systems
Right-handed coordinate system
Left-handed coordinate system
xy
z
xyz
right hand rule: index finger x, second finger y;right thumb points up
left hand rule: index finger x, second finger y;left thumb points down
yxz
yxz
![Page 17: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/17.jpg)
17
Basis Vectors
Take any two vectors that are linearly independent (nonzero and nonparallel)can use linear combination of these to define any other
vector:
bac 21 ww
![Page 18: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/18.jpg)
18
Orthonormal Basis Vectors
If basis vectors are orthonormal (orthogonal (mutually perpendicular) and unit length)owe have Cartesian coordinate systemo familiar Pythagorean definition of distance
0
,1
yx
yx
Orthonormal algebraic properties
![Page 19: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/19.jpg)
19
Basis Vectors and Origins
jiop yx o
p
i
j
Coordinate system: just basis vectorscan only specify offset: vectors
Coordinate frame (or Frame of Reference): basis vectors and origincan specify location as well as offset: points
It helps in analyzing the vectors and solving the kinematics.
![Page 20: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/20.jpg)
20
Working with Frames
pF1
F1
i
jo
jiop yx
![Page 21: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/21.jpg)
21
Working with Frames
pF1
F1 p = (3,-1)
i
jo
jiop yx
![Page 22: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/22.jpg)
22
Working with Frames
pF1
F1 p = (3,-1)
F2
i
jo
jiop yx
F2
ijo
![Page 23: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/23.jpg)
23
Working with Frames
pF1
F1 p = (3,-1)
F2 p = (-1.5,2)
i
jo
jiop yx
F2
ijo
![Page 24: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/24.jpg)
24
Working with Frames
pF1
F1 p = (3,-1)
F2 p = (-1.5,2)
F3
i
j
F2
ijo
F3
ijo
o
jiop yx
![Page 25: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/25.jpg)
25
Working with Frames
pF1
F1 p = (3,-1)
F2 p = (-1.5,2)
F3 p = (1,2)
i
j
F2
ijo
F3
ijo
o
jiop yx
![Page 26: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/26.jpg)
26
Named Coordinate Frames
Origin and basis vectors
Pick canonical frame of reference then don’t have to store origin, basis vectors just convention: Cartesian orthonormal one on previous
slide
Handy to specify others as needed airplane nose, looking over your shoulder, ... really common ones given names in CG
object, world, camera, screen, ...
),,( cbap
zyxop cba
![Page 27: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/27.jpg)
27
Lines
Slope-intercept formy = mx + b
Implicit formy – mx – b = 0
Ax + By + C = 0
f(x,y) = 0
![Page 28: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/28.jpg)
28
Implicit Functions
An implicit function f(x,y) = 0 can be thought of as a height field where f is the height (top). A path where the height is zero is the implicit curve (bottom).
Find where function is 0plug in (x,y), check if
= 0 on line
< 0 inside
> 0 outside
![Page 29: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/29.jpg)
29
Implicit Circles
circle is points (x,y) where f(x,y) = 0
points p on circle have property that vector from c to p
dotted with itself has value r2
points p on the circle have property that squared distance
from c to p is r2
points p on circle are those a distance r from center point c
222 )()(),( ryyxxyxf cc
0)()(:),(),,( 2 ryxcyxp cc cpcp
022 rcp
0 rcp
![Page 30: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/30.jpg)
30
Parametric Curves
Parameter: index that changes continuously(x,y): point on curve
t: parameter
Vector form
)(
)(
th
tg
y
x
)(tfp
![Page 31: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/31.jpg)
31
2D Parametric Lines
start at point p0,
go towards p1,according to parameter tp(0) = p0, p(1) = p1
x
y
x0 t(x1 x0)
y0 t(y1 y0)
)()( 010 pppp tt)()( dop tt
![Page 32: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/32.jpg)
32
Linear Interpolation
Parametric line is example of general concept
Interpolationp goes through a at t = 0
p goes through b at t = 1
Linearweights t, (1-t) are linear polynomials in t
)()( 010 pppp tt
![Page 33: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/33.jpg)
33
Matrix-Matrix Addition
Add: matrix + matrix = matrix
Example
22222121
12121111
2221
1211
2221
1211
mnmn
mnmn
nn
nn
mm
mm
59
81
1472
53)2(1
17
52
42
31
![Page 34: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/34.jpg)
34
Scalar-Matrix Multiplication
Multiply: scalar * matrix = matrix
Example
2221
1211
2221
1211
**
**
mama
mama
mm
mma
153
126
5*31*3
4*32*3
51
423
![Page 35: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/35.jpg)
35
Matrix-Matrix Multiplication
Can only multiply (n, k) by (k, m):number of left cols = number of right rows
legal
undefined
ml
kj
ih
gfe
cba
kj
ih
q
g
p
f
o
e
cba
![Page 36: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/36.jpg)
36
Matrix-Matrix Multiplication
row by column
2221
1211
2221
1211
2221
1211
pp
pp
nn
nn
mm
mm
2112111111 nmnmp
![Page 37: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/37.jpg)
37
Matrix-Matrix Multiplication
row by column
2221
1211
2221
1211
2221
1211
pp
pp
nn
nn
mm
mm
2112111111 nmnmp
2122112121 nmnmp
![Page 38: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/38.jpg)
38
Matrix-Matrix Multiplication
row by column
2221
1211
2221
1211
2221
1211
pp
pp
nn
nn
mm
mm
2112111111 nmnmp
2212121112 nmnmp 2122112121 nmnmp
![Page 39: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/39.jpg)
39
Matrix-Matrix Multiplication
row by column
2221
1211
2221
1211
2221
1211
pp
pp
nn
nn
mm
mm
2112111111 nmnmp
2212121112 nmnmp 2122112121 nmnmp
2222122122 nmnmp
![Page 40: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/40.jpg)
40
Matrix-Matrix Multiplication
row by column
Non commutative: AB != BA
2221
1211
2221
1211
2221
1211
pp
pp
nn
nn
mm
mm
2112111111 nmnmp
2212121112 nmnmp 2122112121 nmnmp
2222122122 nmnmp
![Page 41: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/41.jpg)
41
Matrix-Vector Multiplication
points as column vectors: post-multiply
h
z
y
x
mmmm
mmmm
mmmm
mmmm
h
z
y
x
44434241
34333231
24232221
14131211
'
'
'
'
Mpp'
![Page 42: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/42.jpg)
42
Matrices
Transpose
Identity
Inverse
44342414
43332313
42322212
41312111
44434241
34333231
24232221
14131211
mmmm
mmmm
mmmm
mmmmT
mmmm
mmmm
mmmm
mmmm
1000
0100
0010
0001
IAA 1
![Page 43: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/43.jpg)
43
Matrices and Linear Systems
Linear system of n equations, n unknowns
Matrix form Ax=b
125
1342
4273
zyx
zyx
zyx
1
1
4
125
342
273
z
y
x
![Page 44: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/44.jpg)
44
Exercise 1
Q 1: If the vectors, u and v in figure are coplanar with the sheet of paper, does the cross product v x u extend towards the reader or away assuming right-handed coordinate system?
For u = [1, 0, 0] & v = [2, 2, 1]. Find
Q 2: The length of v
Q 3: length of projection of u onto v
Q 4: v x u
Q 5: Cos t, if t is the angle between u & v
![Page 45: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/45.jpg)
45
Exercise 2
p
F1
F1 p = (?, ?)
F2 p = (?, ?)
F3 p = (?, ?)
ij
F2 i
jo
F3
i
joo
![Page 46: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/46.jpg)
46
Exercise 3
Given P1(3,6,9) and P2(5,5,5). Find a point on the line with end points P1 & P2 at t = 2/3 using parametric equation of line, where t is the parameter.
![Page 47: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/47.jpg)
47
Reading for OpenGL practice: HB 2.9Ready for the Quiz
Things to do
![Page 48: 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551bba1e550346af588b4616/html5/thumbnails/48.jpg)
48
References
1. http://faculty.cs.tamu.edu/schaefer/teaching/441_Spring2012/index.html
2. http://www.ugrad.cs.ubc.ca/~cs314/Vjan2007/
1. http://faculty.cs.tamu.edu/schaefer/teaching/441_Spring2012/index.html
2. http://www.ugrad.cs.ubc.ca/~cs314/Vjan2007/