Download 슬라이드 1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
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


Affine Space


Scalars, vectors, and points
Euclidean Space



Scalars and vectors
Scalars, vectors, points
Concept of distance
Projections
CSE 581 – Interactive Computer Graphics
Scalars (1/2)

Scalar Field


Ex) Ordinary real numbers and operations on them
Two Fundamental Operations

Addition and multiplication
 ,   S ,     S ,     S
     
     
            
            
               
Commutative
Associative
Distributive
CSE 581 – Interactive Computer Graphics
Scalars (2/2)

Two Special Scalars

Additive identity: 0, multiplicative identity: 1
  0  0   
 1  1    

1
Additive inverse   and multiplicative inverse 
of 
      0
   1  1
CSE 581 – Interactive Computer Graphics
Vector Spaces (1/4)

Two Entities: Scalars and Vectors
 Vectors




Directed line segments
n-tuples of numbers
Two operations: vector-vector addition, scalarvector multiplication
Special Vector: Zero Vector
u0u
u   u   0

Let u denote a vector
Directed line segments
CSE 581 – Interactive Computer Graphics
Vector Spaces (2/4)

Scalar-Vector Multiplication
 u  v   u  v
   u  u  u


u and v: vectors, α and β: scalars
Scalar-vector multi.
Vector-Vector Addition

Head-to-tail axiom: to visualize easily
Head-to-tail axiom
CSE 581 – Interactive Computer Graphics
Vector Spaces (3/4)

Vectors = n-tuples v  v1 , v2 ,, vn 

Vector-vector addition
u  v  u1 , u2 , , un   v1 , v2 , , vn 
 u1  v1 , u2  v2 , , un  vn 


Scalar-vector multiplication

Vector space: R n
v  v1 , v2 ,, vn 
Linear Independence





Linear combination: u  1u1   2u2     nun
Vectors
are
if the only set of scalars

 linear independent

1u1   2u2     nun  0 is 1   2     n  0
CSE 581 – Interactive Computer Graphics
Vector Spaces (4/4)

Dimension




The greatest number of linearly independent vectors
Basis

n linearly independent vectors (n: dimension)

Unique expression in terms of the basis vectors
Representation  i 




v  1v1   2v2     n vn
Change of Basis: Matrix M

 

Other basis v1 , v2 , , vn




 v  1v1   2v2     nvn
 1 
 1 
  
 
 2   M 2 
  
  
 
 

 n 
 n 
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 System

Origin: a particular reference point
Basis
vectors
located
at the
origin
Identical vectors
Arbitrary
placement
of basis
vectors
CSE 581 – Interactive Computer Graphics
Affine Spaces (2/2)

Third Type of Entity: Points
 New Operation: Point-Point Subtraction

P and Q : any two points

v  P Q
 vector-point addition

P  v Q
P  Q  Q  R  P  R Head-to-tail axiom for points
 

 Frame: a Point P0 and a Set of Vectors v1 , v2 , , vn

Representations of the vector and point: n scalars
Vector
v  1v1   2 v2     n vn
Point
P  P0  1v1   2 v2     n vn
CSE 581 – Interactive Computer Graphics
Euclidean Spaces (1/2)

No Concept of How Far Apart Two Points in
Affine Spaces!!
 New Operation: Inner (dot) Product


Combine two vectors to form a real
α, β, γ, …: scalars, u, v, w, …:vectors
u v  v u
u  v   w  u  w  v  w
v  v  0 if v  0
00  0

Orthogonal: u  v  0
CSE 581 – Interactive Computer Graphics
Euclidean Spaces (2/2)

Magnitude (length) of a vector
v 

Distance between two points
P Q 

vv
P  Q   P  Q 
Measure of the angle between two vectors
u  v  u v cos


cosθ = 0  orthogonal
cosθ = 1  parallel
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 other
w  v  u
w  v  v  v  u  v  v  v
wv
 
vv
wv
 u  w  v  w 
v
vv
Projection of one
vector onto another
CSE 581 – Interactive Computer Graphics
Matrices






Definitions
Matrix Operations
Row and Column Matrices
Rank
Change of Representation
Cross Product
CSE 581 – Interactive Computer Graphics
What is a Matrix?

A matrix is a set of elements, organized into
rows and columns
rows
columns
a b 
c d 


6.837 Linear Algebra Review
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 aij , i  1, , n, j  1, , m
 
 
A  aij

Transpose: interchanging the rows and columns of a
matrix
T
 
A  a ji
 b1 
 Column Matrices and Row Matrices  
b2 

 Column matrix (n x 1 matrix): b  bi  

 Row matrix (1 x n matrix): b T
 
bn 
CSE 581 – Interactive Computer Graphics
Basic Operations

Addition, Subtraction, Multiplication
a b   e
c d    g

 
f  a  e b  f 


h  c  g d  h 
Just add elements
a b   e
c d    g

 
f  a  e b  f 


h  c  g d  h 
Just subtract elements
a b   e
c d   g


f  ae  bg


h  ce  dg
6.837 Linear Algebra Review
af  bh
cf  dh 
Multiply each
row by each
column
CSE 581 – Interactive Computer Graphics
Matrix Operations (1/2)

Scalar-Matrix Multiplication
A  aij 

Matrix-Matrix Addition
C  A  B  aij  bij 

Matrix-Matrix Multiplication

A: n x l matrix, B: l x m  C: n x m matrix
 
C  AB  cij
l
cij   aik bkj
k 1
CSE 581 – Interactive Computer Graphics
Matrix Operations (2/2)

Properties of Scalar-Matrix Multiplication

Properties of Matrix-Matrix Addition
  A    A
A  A


AB BA
Commutative:
Associative: A  B  C  A  B

 
 C

Properties of Matrix-Matrix Multiplication

Identity Matrix I (Square Matrix)
ABC  AB C
AB  BA
1 if i  j
I  aij , aij  
0 otherwise
 
AI  A
IB  B
CSE 581 – Interactive Computer Graphics
Multiplication

Is AB = BA? Maybe, but maybe not!
a b   e
c d   g



f  ae  bg ...


h   ...
...
e
g

f  a b  ea  fc ...




h   c d   ...
...
Heads up: multiplication is NOT commutative!
6.837 Linear Algebra Review
CSE 581 – Interactive Computer Graphics
Row and Column Matrices



pT: row matrix
Concatenations


 x
p   y 
 z 
Column Matrix
p  Ap
p  ABCp
Associative
By Row Matrix
AB T
 BT A T
pT  pT CT BT AT
CSE 581 – Interactive Computer Graphics
Vector Operations

Vector: 1 x N matrix
 Interpretation: a line
in N dimensional
space
 Dot Product, Cross
Product, and
Magnitude defined on
vectors only
a 
  
v  b 
 c 
y
v
x
6.837 Linear Algebra Review
CSE 581 – Interactive Computer Graphics
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
 x  a b   x' 
 y   c d    y '
 
  
6.837 Linear Algebra Review
V
V’
CSE 581 – Interactive Computer Graphics
Vectors: Dot Product

Interpretation: the dot product measures to what
degree two vectors are aligned
A
B
C
B
A+B = C
(use the head-to-tail
method to combine
vectors)
A
6.837 Linear Algebra Review
CSE 581 – Interactive Computer Graphics
Vectors: Dot Product
d 
a  b  abT  a b c e   ad  be  cf
 f 
a  aa T  aa  bb  cc
2
a  b  a b cos( )
6.837 Linear Algebra Review
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
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”
a  b  a b sin(  )
6.837 Linear Algebra Review
CSE 581 – Interactive Computer Graphics
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 noncommutativity property
6.837 Linear Algebra Review
1 0 0


I  0 1 0 
0 0 1
CSE 581 – Interactive Computer Graphics
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
6.837 Linear Algebra Review
a b 
A

c
d


det( A)  ad  bc
1  d  b
A 
ad  bc  c a 
1
CSE 581 – Interactive Computer Graphics
Determinant of a Matrix
a b
d e
g h
c
f  aei  bfg  cdh  afh  bdi  ceg
i
a b
d e
g h
c a b
f d e
i g h
c a b
f d e
i g h
6.837 Linear Algebra Review
c
f
i
Sum from left to right
Subtract from right to lef
Note: N! terms
CSE 581 – Interactive Computer Graphics
Change of Representation (1/2)

Matrix Representation of the Change between
the Two Bases

Ex) two bases u1 , u2 , , un  and v1 , v2 ,, vn 
v  1u1   2u2     nun
or
v  1v1   2v2     n vn

Representations of v
a  1  2   n 
T

or
b  1  2   n 
T
Expression of u1 , u2 , , un  in the basis v1 , v2 ,, vn 
ui   i1v1   i 2v2     invn ,
i  1,, n
CSE 581 – Interactive Computer Graphics
Change of Representation (2/2)
 


 u1 
 v1 
A 
:
n
x
n
matrix
ij
u 
v 
 2   A 2 
 
 
 
 
un 
v n 
 u1 
a 
and
b


i
i
u 
v  aT  2  or
 
 
un 
 By direct substitution
 v1 
 v1 
 u1 
 v1 
v 
v 
u 
v 
aT A  2   b T  2 
aT  2   bT  2 
 
 
 
 
 
 
 
 
 vn 
v n 
u n 
vn 
 
 
 v1 
v 
v  bT  2 
 
 
 vn 
 b T  aT A
CSE 581 – Interactive Computer Graphics
Cross Product

In 3D Space, a unit Vector, w, is Orthogonal to
Given Two Nonparallel Vectors, u and v
wu  w v  0

Definition

Consistent Orientation
 2  3   3  2 
w  u  v    3 1  1 3 
1 2   2 1 
where u  1 ,  2 ,  3 , v  1 ,  2 , 3 

Ex) x-axis x y-axis = z-axis
CSE 581 – Interactive Computer Graphics
Related documents