Date post: | 26-Dec-2015 |
Category: |
Documents |
Upload: | dayna-ball |
View: | 231 times |
Download: | 0 times |
Graphics
CSE 581 – Interactive Computer Graphics
Mathematics for Computer Graphics
CSE 581 – Roger Crawfis(slides developed from Korea University slides)
CSE 581 – Interactive Computer Graphics
Spaces
Scalars (Linear) Vector Space
Scalars and vectors
Affine Space Scalars, vectors, and points
Euclidean Space Scalars, vectors, points Concept of distance
Projections
CSE 581 – Interactive Computer Graphics
Scalars (1/2)
Scalar FieldScalar Field Ex) Ordinary real numbers and operations on them
Two Fundamental Operations Addition and multiplication
SSS , ,,
Associative
Commutative
Distributive
CSE 581 – Interactive Computer Graphics
Scalars (2/2)
Two Special Scalars Additive identity: 0, multiplicative identity: 1
Additive inverse and multiplicative inverse of
11
00
1
1
01
CSE 581 – Interactive Computer Graphics
Vector Spaces (1/4)
Two Entities: ScalarsScalars and VectorsVectors Vectors
Directed line segments n-tuples of numbers Two operations: vector-vector addition, scalar-
vector multiplication
Special Vector: Zero VectorZero Vector
Let u denote a vector
Directed line segments
0
0
uu
uu
CSE 581 – Interactive Computer Graphics
Vector Spaces (2/4)
Scalar-Vector Multiplication
u and v: vectors, α and β: scalars
Vector-Vector Addition Head-to-tail axiom: to visualize easily
uuu
vuvu
Head-to-tail axiom
Scalar-vector multi.
CSE 581 – Interactive Computer Graphics
Vector Spaces (3/4)
Vectors = n-tuples Vector-vector addition
Scalar-vector multiplication
Vector space:
Linear IndependenceLinear Independence Linear combination:
nvvvv ,,, 21
nn
nn
vuvuvu
vvvuuuvu
,,,
,,,,,,
2211
2121
nvvvv ,,, 21 nR
nnuuuu
2211
Vectors are linear independent if the only set of scalars is
02211 nnuuu
021 n
CSE 581 – Interactive Computer Graphics
Vector Spaces (4/4)
DimensionDimension The greatest number of linearly independent vectors
BasisBasis n linearly independent vectors (n: dimension)
Representation Unique expression in terms of the basis vectors
Change of Basis: Matrix M Other basis
nnvvvv
2211
i
nvvv
,,, 21
nnvvvv
2211
nn
2
1
2
1
M
CSE 581 – Interactive Computer Graphics
Affine Spaces (1/2)
No Geometric Concept in Vector Space!! Ex) location and distance Vectors: magnitude and direction,
no position
Coordinate SystemCoordinate System Origin: a particular reference point Identical vectors
Arbitraryplacement
of basisvectors
Basisvectorslocatedat theorigin
CSE 581 – Interactive Computer Graphics
Affine Spaces (2/2)
Third Type of Entity: PointsPoints New Operation: Point-Point SubtractionPoint-Point Subtraction
P and Q : any two points
vector-point addition
FrameFrame: a Point and a Set of Vectors Representations of the vector and point: n scalars
QPv
QvP
Head-to-tail axiom for points RPRQQP
0P nvvv
,,, 21
nn
nn
vvvPP
vvvv
22110
2211Vector
Point
CSE 581 – Interactive Computer Graphics
Euclidean Spaces (1/2)
No Concept of How Far Apart Two Points in Affine Spaces!!
New Operation: Inner (dot) ProductInner (dot) Product Combine two vectors to form a real α, β, γ, …: scalars, u, v, w, …:vectors
Orthogonal:
0
if 0
00
0vvv
wvwuwvu
uvvu
0vu
CSE 581 – Interactive Computer Graphics
Euclidean Spaces (2/2)
Magnitude (length) of a vector
Distance between two points
Measure of the angle between two vectors
cosθ = 0 orthogonal cosθ = 1 parallel
QPQPQP
cosvuvu
vvv
CSE 581 – Interactive Computer Graphics
Projections
Problem of Finding the Shortest Distance from a Point to a Line of Plane
Given Two Vectors, Divide one into two parts: one
parallel and one orthogonal to the otherProjection of one
vector onto anotheruvw
vvvuvvvw
vv
vw
vvv
vwwvwu
CSE 581 – Interactive Computer Graphics
Matrices
Definitions Matrix Operations Row and Column Matrices Rank Change of Representation Cross Product
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
What is a Matrix?
A matrix is a set of elements, organized into rows and columns
dc
barows
columns
CSE 581 – Interactive Computer Graphics
Definitions
n x m Array of Scalars (n Rows and m Columns) n: row dimension of a matrix, m: column dimension m = n square matrix of dimension n Element
Transpose: interchanging the rows and columns of a matrix
Column Matrices and Row Matrices Column matrix (n x 1 matrix): Row matrix (1 x n matrix):
mjniaij ,,1 ,,,1 , ijaA
jiT aA
n
i
b
b
b
b2
1
bTb
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
Basic Operations
Addition, Subtraction, Multiplication
hdgc
fbea
hg
fe
dc
ba
hdgc
fbea
hg
fe
dc
ba
dhcfdgce
bhafbgae
hg
fe
dc
ba
Just add elements
Just subtract elements
Multiply each row by each
column
CSE 581 – Interactive Computer Graphics
Matrix Operations (1/2)
Scalar-Matrix MultiplicationScalar-Matrix Multiplication
Matrix-Matrix AdditionMatrix-Matrix Addition
Matrix-Matrix MultiplicationMatrix-Matrix Multiplication A: n x l matrix, B: l x m C: n x m matrix
ija A
ijij ba BAC
l
kkjikij
ij
bac
c
1
ABC
CSE 581 – Interactive Computer Graphics
Matrix Operations (2/2)
Properties of Scalar-Matrix Multiplication
Properties of Matrix-Matrix Addition Commutative: Associative:
Properties of Matrix-Matrix Multiplication
Identity MatrixIdentity Matrix I (Square Matrix)
AA
AA
ABBA CBACBA
BAAB
CABBCA
otherwise 0
if 1 ,
jiaa ijijI BIB
AAI
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
Multiplication
Is AB = BA? Maybe, but maybe not!
Heads up: multiplication is NOT commutative!
......
...bgae
hg
fe
dc
ba
......
...fcea
dc
ba
hg
fe
CSE 581 – Interactive Computer Graphics
Row and Column Matrices
Column Matrix
pT: row matrix
ConcatenationsConcatenations Associative
By Row Matrix
z
y
x
p
ABCpp
App
TTTTT
TTT
ABCpp
ABAB
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
Vector Operations
Vector: 1 x N matrix Interpretation: a line
in N dimensional space
Dot Product, Cross Product, and Magnitude defined on vectors only
c
b
a
v
x
y
v
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
Vector Interpretation
Think of a vector as a line in 2D or 3D Think of a matrix as a transformation on a line
or set of lines
'
'
y
x
dc
ba
y
xV
V’
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
Vectors: Dot Product
Interpretation: the dot product measures to what degree two vectors are aligned
A
B
A
BC
A+B = C(use the head-to-tail method to combine
vectors)
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
Vectors: Dot Product
cfbead
f
e
d
cbaabba T
ccbbaaaaa T 2
)cos(baba
Think of the dot product as a matrix multiplication
The magnitude is the dot product of a vector with itself
The dot product is also related to the angle between the two vectors – but it doesn’t tell us the angle
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
Vectors: Cross Product
The cross product of vectors A and B is a vector C which is perpendicular to A and B
The magnitude of C is proportional to the cosine of the angle between A and B
The direction of C follows the right hand rule – this why we call it a “right-handed coordinate system”
)sin(baba
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
Inverse of a Matrix
Identity matrix: AI = A
Some matrices have an inverse, such that:AA-1 = I
Inversion is tricky:(ABC)-1 = C-1B-1A-1
Derived from non-commutativity property
100
010
001
I
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
Determinant of a Matrix
Used for inversion If det(A) = 0, then A
has no inverse Can be found using
factorials, pivots, and cofactors!
Lots of interpretations – for more info, take 18.06
dc
baA
bcadA )det(
ac
bd
bcadA
11
CSE 581 – Interactive Computer Graphics
6.837 Linear Algebra Review
Determinant of a Matrix
cegbdiafhcdhbfgaei
ihg
fed
cba
ihg
fed
cba
ihg
fed
cba
ihg
fed
cbaSum from left to rightSubtract from right to leftNote: N! terms
CSE 581 – Interactive Computer Graphics
Change of Representation (1/2)
Matrix Representation of the Change between the Two Bases Ex) two bases and
Representations of v
Expression of in the basis
nuuu ,,, 21 nvvv ,,, 21 nnuuuv 2211
nnvvvv 2211
or
Tn 21 a Tn 21 bor
nuuu ,,, 21 nvvv ,,, 21
nivvvu niniii ,,1 ,2211
CSE 581 – Interactive Computer Graphics
Change of Representation (2/2)
: n x n matrix
and
By direct substitution
nn v
v
v
u
u
u
2
1
2
1
A
ijA
ia ib
n
T
u
u
u
v2
1
a
n
T
v
v
v
v2
1
bor
n
T
n
T
v
v
v
u
u
u
2
1
2
1
ba
n
T
n
T
v
v
v
v
v
v
2
1
2
1
bAa Aab TT
CSE 581 – Interactive Computer Graphics
Cross Product
In 3D Space, a unit Vector, w, is Orthogonal to Given Two Nonparallel Vectors, u and v
Definition
Consistent Orientation Ex) x-axis x y-axis = z-axis
0 vwuw
1221
3113
2332
vuw
321321 ,, ,,, where vu