math&com graphics lab vector hyoungseok b. kim dept. of multimedia eng. dongeui university
TRANSCRIPT
Math&Com Graphics Lab
Vector
Hyoungseok B. Kim
Dept. of Multimedia Eng.Dongeui University
Math&Com Graphics Lab.
Dongeui University 2
What is Computer Game ? To make us fun by using computer Computer Game
Sense of Sight (Computer Graphics) Sense of Hearing (Sound) Sense of Touch (Interaction) Interesting Story
What is Computer Graphics Technologies of creating virtual space and displaying it on
computer monitor by using computer Computer Graphics
Modeling Rendering Animation
Game and Graphics
Math&Com Graphics Lab.
Dongeui University 3
Computer Graphics
3D Virtual Space = Model + Light
2D Virtual Space
Camera (Clipping, Projection, Hidden-Surface Removal)
Rasterization
Screen Space
3 차원 공간3 차원 공간
필름 필름
사진 현상 사진 현상
Math&Com Graphics Lab.
Dongeui University 4
transformation 좌표 변환을 위한 4×4 matrix multiplication
clipping projection plane 상에서 불필요한 부분 제거
projection 3D object 2D image mapping
rasterization image 를 frame buffer 에 저장하는 과정
OpenGL Pipeline Architecture
Math&Com Graphics Lab.
Dongeui University 5
Where is Mathematics in Computer Graphics ? Creation of Objects
Vertices, edges, faces, box, sphere, cylinder, torus, … Handle of Objects
Transformation : translation, scaling, rotation Handle of Camera
Position, Orientation, Lens, Projection Handle of Light
Shadow Handle of Motion
Character motion, animation of all kinds of objects Handle of Rendering
Image based rendering …..
Game Mathematics
Math&Com Graphics Lab.
Dongeui University 6
Standard Language in Mathematics Quantity
Scalar : Magnitude( 크기 ) Vector : Magnitude( 크기 ), Orientation( 방향 )
Representation of Quantities Scalar : real number
1 , 2, 0.72534, 3 / 7
Vector : Arrow 시점과 종점
Scalar vs Vector
시점
종점
inefficient
Your answer ?
Math&Com Graphics Lab.
Dongeui University 7
Equality and Efficient Representation Find out the samesame vectors as the given vector A ?
same magnitude, same color Blue arrow
Efficient Representation Assume that the start point of all vectors is the Origin in the space.
Vector
A
Math&Com Graphics Lab.
Dongeui University 8
Vector
Representation of Vector
Position of the End Point :
),( yx
시점
종점
종점
종점종점
32 ),,(,),( RzyxRyx
Math&Com Graphics Lab.
Dongeui University 9
Operators of Vectors
Same if and only if
Magnitude
Addition
Inner Product
Cross Product
VU xx vu yy vu zz vu
222zyx uuu U
),,( zzyyxx vuvuvu VU
zzyyxx vuvuvu VU
),,( xyyxzxxzyzzy
zyx
zyx vuvuvuvuvuvu
vvv
uuu kji
VU
Math&Com Graphics Lab.
Dongeui University 10
Inner Product
Properties
1. Why ?
2. Why ?
코사인 제 2 법칙
2UUU
cosVUVU
U
V
VU
Math&Com Graphics Lab.
Dongeui University 11
Inner Product
1.
2.
What is the inner product used for ? To confirm whether the angle is right or not…….
2)()( VUVUVU
cosVUVU
222)()( VVUUVUVU
cos2222
VUVUVU
Math&Com Graphics Lab.
Dongeui University 12
Inner Product’s Applications
1. ?
2. Compute a plane P passing through a given point
with the normal vector
)0,0,1(UVU (0,1,0)V
),,( cbaU),,( 111 zyxA
UAP ),,(),,( 111 zyxzyx0),,(),,( 111 cbazzyyxx
111 czbyaxczbyax
Math&Com Graphics Lab.
Dongeui University 13
Inner Product’s Applications
3. Compute the distance of a point
from a line L passing through
with a unit directional vector
4. Compute the distance of a point
from a Plane P passing through
with a unit Normal vector
distance = ?
5. Up side or Down side ?
),,( 111 zyxA
),,( 222 zyxB),,( cbaU
UUBABA )( d
),,( 111 zyxA
),,( 222 zyxB),,( cbaN
NBA
Math&Com Graphics Lab.
Dongeui University 14
Back Face Removal
Which are back faces ?
vx
vy
vz
front faceback face
How to compute ?
What is a counter-example ?
Math&Com Graphics Lab.
Dongeui University 15
Back Face Removal
Counter-example
Math&Com Graphics Lab.
Dongeui University 16
Cross Product
Properties : A new vector orthogonal to both two vectors
Area of a Triangle with edges and
VUsinVUVU
2222)()()( xyyxzxxzyzzy vuvuvuvuvuvu VU
22222222)())(( zzyyxxzyxzyx vuvuvuvvvuuu VU
222222cosVUVUVU
2222222sin)cos1( VUVUVU
U V
U
V
VU2
1Area Why ?
Math&Com Graphics Lab.
Dongeui University 17
Cross Product’s Applications
Normal Vector Computation Parametric Surface
vu
v
zv
yv
x
v
u
zu
yu
x
u
vuz
vuy
vux
vu
ppn
pp
p
,
),(
),(
),(
),(
Math&Com Graphics Lab.
Dongeui University 18
Cross Product’s Applications
Normal Vector Computation Polygonal Mesh
cba
)()( 0201 ppppn
),,( 1111 zyxp
),,( 2222 zyxp
),,( 0000 zyxp
0 dczbyax
Math&Com Graphics Lab.
Dongeui University 19
Vector Space
The set of vectors satisfying 9 properties addition, scalar multiplication, identity, additive inverse, commutative law, distributive law
Examples)
Properties) Linearly dependence
linearly independent
linearly dependent
Is the set linearly dependent ?
32 ,RR
2R)2,1(1 U )1,2(2 U
)4,2(3 U
21 UU
31 UU
},{ 21 UU
},{ 21 UU
)5,1(4 U
},,,{ 4321 UUUU
Math&Com Graphics Lab.
Dongeui University 20
Vector Space
1 차 독립 (Linearly Independent) 만약 다음을 만족한다면
은 “ 1 차 독립”라고 함
만약 그렇지 않다면 , 은 “ 1 차 종속”이라 함
즉 , 이라면
0321 n 0332211 nnUUUU
},,,{ 21 nUUU
},,,{ 21 nUUU
0m
)(1
332211 nnm
m UUUUU
Math&Com Graphics Lab.
Dongeui University 21
Vector Space
Linearly dependence in
linearly dependent linearly independent linearly dependent
3R
)0,1,2(1 U
)0,2,1(2 U
)0,3,3(3 U
)1,1,1(4 U
},,{ 321 UUU
},,{ 421 UUU
},,,{ 4321 UUUU
Math&Com Graphics Lab.
Dongeui University 22
Vector Space
Basis 이 벡터공간 에서 1 차 독립이며 그 공간에 있는 모든 벡터들을 다음과 같이 1 차 선형조합으로 표현가능 하면
이 벡터공간 의 기저 (basis)
예제
의 basis 에는 어떤 것이 있는가 ?
},,,{ 21 nUUU V
nnP UUUU 332211
},,,{ 21 nUUU V
2RV
)}1,2(),2,1{(
)}4,2(),2,1{(
)}3,2(),3,1(),2,1{(
Math&Com Graphics Lab.
Dongeui University 23
Vector Space
Question 1. 서로 수직인 basis 는 무엇인가 ?
Orthogonal basis 가 왜 필요하나 ?
일반 basis 를 orthogonal basis 로 바꾸는 방법은 있을까 ? Gram-schmit Orthogonalization
2RV )}1,0(),0,1{(
'1
12'
''
k
i
k k
kiii e
e
eeee
Math&Com Graphics Lab.
Dongeui University 24
Frame
Frame Point + Orthogonal basis : three orthogonal vectors
(0, 0, 0) +
Frame Transformation
kj,i,
kji cbaP
CBA fedP
i
j
k
A
B
C
P
d = ?
e = ?
f = ?
Math&Com Graphics Lab.
Dongeui University 25
Coordinate Transform : Point
original frame v1, v2, v3, P0
new frame u1, u2, u3, Q0
mapping
frame newin
frame originalin
0332211
0332211
Q
PP
uuu
vvv
03432421410
3332321313
3232221212
3132121111
PQ
vvv
vvvu
vvvu
vvvu
1
0
0
0
434241
333231
232221
131211
M
0
3
2
1
321
0
3
2
1
321
0
3
2
1
321 111
PPQ
v
v
v
v
v
v
Mu
u
u
w