Upload
shavonne-sutton
View
219
Download
1
Embed Size (px)
Citation preview
Graphics
cgvr.korea.ac.kr Graphics Lab @ Korea University
1.2 Notation and Definition
2002. 03. 20그래픽스 연구실
정병선
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Mathematical Definition (1/2)
Type Notation Examples
angle lower-case Greek
scalar lower-case italic
vector or point lower-case bold a,u,vs,h(ρ),hz
matrix capital bold T(t),X,Rx(ρ)
plane π: a vector +
a scalar
π: n·x + d,
π1:n1·x+d1
triangle ∆ 3 points ∆v0v1v2, ∆cba
line segment two points uv,aibj
geometric entity capital italic
242,,,,i
ijk wvutba ,,,,,
AABBOBB BTA ,,
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Mathematical Definition (2/2)
Operator Description
1: ∙ dot product
2: cross product
3: vT transpose of the vector v
4: piecewise vector multiplication
5: ┴ the unary, perp dot product operator
6: | ∙ | determinant of a matrix
7: | ∙ | absolute value of a scalar
8: || ∙ || length (or norm) of argument
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Definition
Rendering primitives points, lines, triangles
Model or object a collection of geometric entities may have a higher kind of geometrical
representation. ex) Bezier curves or surfaces, NURBS, subdivision
surfaces, etc.
Scene a collection of models with environment include material descriptions, lighting, viewing
specifications.
Graphics
cgvr.korea.ac.kr Graphics Lab @ Korea University
Appendix A -Some Linear Algebra
2002. 03. 20그래픽스 연구실
정병선
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Euclidean Space (1/6)
Vector Rn : n-dimensional real Euclidean space v : an n-tuple, i.e. an ordered list of real numbers column-major form
1,,0,
1
1
0
niRvwith
v
v
v
vRv i
n
n
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Euclidean Space (2/6)
Addition
Multiplication by a scalar
n
nnnn
R
vu
vu
vu
v
v
v
u
u
u
vu
11
11
00
1
1
0
1
1
0
n
n
R
au
au
au
au
1
1
0
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Euclidean Space (3/6)
Associativity
Commutativity
Zero identity
Additive inverse
)()( wvuwvu
uvvu
vv 0
0)( vv
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Euclidean Space (4/6)
Scalar multiple associativity
Distributive law
Multiplicative identity
)()( buauab
buauuba )(
avauvua )(
uu 1
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Euclidean Space (5/6)
Dot product
It’s rules
1
0
n
i iivuvu
vuvu
uvvu
vuavau
wvwuwvu
uifonlyandifuuwithuu
0
)()(
)(
0)0,,0,0(0,0
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Euclidean Space (6/6)
Norm
It’s rules
)(1
0
2
n
i iuuuu
)(
)(
0)0,,0,0(0
inequalitySchwartzCauchyvuvu
inequalitytrianglevuvu
uaau
uu
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Interpretation (1/10)
Linearly independent
Span the Euclidean space Rn
tindependenlinearlyareuuvectorsthe
vvvscalarstheifonly
uvuv
n
n
nn
,,,,
0,
0
10
110
1100
nn
n
n
iii
n
RspaceEuclideanthespantosaidareuu
tindependenlinearlyuuvectorstheuvvRv
10
10
1
0
,,
:,,,,,
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Interpretation (2/10)
Basis of Rn
Dimension of space The largest number of linearly independent vectors in
the space
nn
n
iiin
n
Rofbasisauu
uvvthatsuchvvscalarstheRv
:,,
,,,!,
10
1
010
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Interpretation (3/10)
Illustration of 3D vector
v = (v0, v1, v2) u0, u1, u2 : bases right-handed system
u0
u1
u2
v
v0
v1
v2
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Interpretation (4/10)
vector(u) + vector(v)
scalar(a) x vector(w)
u+v
u
vu+v
v
u
w w
aw
-aw
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Interpretation (5/10)
Illustration of dot product
u
v
20
200
0
cos
ifvu
ifvu
vuvu
vuvu
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Interpretation (6/10)
Orthonormal basis
Orthogonal basis
Standard basis
ji
jiuu ji ,1
,0
jiuu ji ,1
TTT eee )1,0,0(,)0,1,0(,)0,0,1( 210
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Interpretation (7/10)
Orthogonal projection
u-wu
w
v
scalart
vectorswvu
tvvvv
vuv
v
vuw
:
:,,
,2
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Interpretation (8/10)
Cross product
w=uxv
u
v
systemhandedrightaformwvu
vwanduw
vuvuw
,,
sin
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Interpretation (9/10)
Laws of calculation of cross product
)()()()(
)(
)()(
)()(
)()(
)()()()(
)(
producttriplevectorwvuvwuwvu
producttriplescalar
uvwvwu
wuvvuw
uwvwvu
linearitywvbwuawbvau
itycommutativantiuvvu
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometrical Interpretation (10/10)
Equation of cross product
Sarrus’s scheme
xyyx
zxxz
yzzy
z
y
x
vuvu
vuvu
vuvu
vu
w
w
w
w
zyxzyx
zyxzyx
zyxzyx
vvvvvv
uuuuuu
eeeeee
+ + + - - -
)()()(
)()()(
xyzzxyyzx
yxzxzyzyx
vuevuevue
vuevuevuevu
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (1/15)
p x q matrix p rows and q columns
ijqppp
q
q
m
mmm
mmm
mmm
M
1,11,10,1
1,11110
1,01200
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (2/15)
Identity(unit) matrix matrix-form counterpart of scalar number one square matrix
10000
01000
00010
00001
I
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (3/15)
Matrix-Matrix addition M + N = [mij] + [nij] = [mij + nij]
(L + M) + N = L + (M + N) M + N = N + M M + 0 = M M – M = 0
Scalar-Matrix multiplication T = aM = [amij]
0M = 0 1M = M a(bM) = (ab)M a0 = 0 (a + b)M = aM + bM a(M + N) = aM + aN
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (4/15)
Transpose of matrix MT = [mji]
(aM)T = aMT
(M + N)T = MT + NT
(MT)T = M (MN)T = NTMT
Trace of matrix
1
0
)(n
iiimMtr
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (5/15)
Matrix-Matrix multiplication
1
0 1,,1
1
0 0,,1
1
0 1,,0
1
0 0,,0
1,10,1
1,000
1,10,1
1,000
q
i riip
q
i iip
q
i rii
q
i ii
rqq
r
qpp
q
nmnm
nmnm
nn
nn
mm
mm
MNT
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (6/15)
Matrix-Vector multiplication
1
0
1
0
1
0 ,1
1
0 ,0
1
0
1,10,1
1,000
ppq
k kkp
q
k kk
pqpp
q
w
w
vm
vm
vm
vm
v
v
mm
mm
Mvw
0w
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (7/15)
Rules for matrix-matrix multiplication (LM)N = L(MN) (L + M)N = LN + MN MI = IM = M In general, MN ≠ NM
Determinant of matrix 2 x 2 matrix
100111001110
0100 mmmmmm
mmM
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (8/15)
3 x 3 matrix
zyxzyx mmmmmmmmmM
mmmmmmmmm
mmmmmmmmm
mmm
mmm
mmm
M
)(2,1,0,
211200221001201102
211002201201221100
222120
121110
020100
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (9/15)
Rules of determinant calculation |M-1| = 1 / |M| |MN| = |M| |N| |aM| = an|M| |MT| = |M| If M = [ami,] or M = [am,j], then |M| = a|M|.
If for i ≠ j, mi, = mj, or m,i = m,j , then |M| = 0.
If for some i, mi, = 0 or m,i = 0, then |M| = 0.
Orientation of basis |bases| > 0 : right-handed system |bases| < 0 : left-handed system
ex) |ex ey ez| = 1 > 0
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (10/15)
Adjoint matrix subdeterminant
adjoint
1,11,11,110
1,11,11,10,1
1,11,11,10,1
1,01,01,000
nnjnjnn
nijijii
nijijii
njj
Mij
mmmm
mmmm
mmmm
mmmm
d
Mji
jiijij daaMadj )()1(,)(
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (11/15)
Inverse of matrix must |M| ≠ 0 If MN = I and NM = I, then N = M-1.
Implicit method u = Mv gives v = M-1u Cramer’s rule
1,1,1,1,0,
niii
ii
mmummmd
M
dv
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (12/15)
Solution by Cramer’s rule for 3 x 3 system
Explicit method Gaussian elimination
Mu = Iv
General case
),,det(
),,det(
),,det(1
umm
mum
mmu
Mv
v
v
v
yx
zx
zy
z
y
x
)(11 MadjM
M
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (13/15)
Import rules of inverse (M-1)T = (MT)-1
(MN)-1 = N-1M-1
Eigenvalue and Eigenvector Ax = λx (A : square matrix, x : vector, λ : scalar)
x : eigenvector λ : eigenvalue
Theoretical results
orthogonalrseigenvectorealseigenvaluesymmetricrealA
AaAtrn
i i
n
i i
n
i ii
:,:,:)3(
)det()2()()1(1
0
1
0
1
0
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (14/15)
Orthogonal matrices If MMT = MTM = I, then the sqaure matrix M is orthog
onal. Significant implications
|M| = + 1 M-1 = MT
MT : orthogonal ||Mu|| = ||u|| Mu ┴ Mv iff u ┴ v If M, N are orthogonal , then MN is orthogonal.
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Matrices (15/15)
Change of base current coordinate system to another coordinate syst
em Fw = ( fx fy fz )w = v w = F-1v
If F is orthogonal, F-1 = FT.
v
f
f
f
vFwTz
Ty
Tx
T
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Homogeneous Notation
Point and Vector p = (px, py, pz, pw)T
point : pw = 1
vector : pw = 0
Rotation, scaling, shearing and translation
1000
0
0
0
222120
121110
020100
44 mmm
mmm
mmm
M
1000
100
010
001
z
y
x
t
t
t
T
rotation, scaling, shear matrix translation matrix
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometry (1/8)
Two-dimensional line (L)
d
or(t)
td = r(t) - o L
Figure of r(t) = o + td
n
pqL
Figure of n · (p – q) = 0
Explicit form Implicit form
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometry (2/8)
Half-plane test ( f(p) = n · p + c, c = -q · n )
Signed distance
.int0)(.3
.int0)(.2
.0)(.1
nqpotheaslinetheofsidesametheonliesppf
nqpotheaslinetheofsidesametheonliesppf
Lppf
)()(1
)()(
pfpfnnn
pfpf
s
s
Lp
n
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometry (3/8)
Three-dimensional line same as two-dimensional line except for 3D Distance p to r(t)
p
od
w
||(p – o) – w||
r(t)
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometry (4/8)
Planes (π)
Explicit form Implicit form
du
dv
o
p(u,v) = o + udu+ vdv
udu
vdv
p
q
n
Figure of p(u,v) = o + udu+ vdv Figure of n · ( p – q ) = 0
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometry (5/8)
Half-plane test ( f(p) = n · p + d, d = -n · q )
Signed distance obtained by exchanging the two-dimensional parts of the eq
uation for their three-dimensional counterparts for the plane. fs(0) = d, d : the shortest signed distance from the origin to th
e plane.
.int0)(.3
.int0)(.2
.0)(.1
nqpotheasplanetheofsidesametheonliesppf
nqpotheasplanetheofsidesametheonliesppf
ppf
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometry (6/8)
Convex hull the smallest set such that the straight line between
any two points in the set is totally included in the set as well.
rubber band
convex hull
release
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometry (7/8)
Area calculation
)()(2
1)( rqrppqrArea
||v||sinΦ
Φ
v
u
sinvuvu
p
q r
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Geometry (8/8)
Volume calculation
u x v
w
v
u
Φ
wvuwvuwvuVolume )(),,(
Graphics
cgvr.korea.ac.kr Graphics Lab @ Korea University
Chapter 3 - Transforms
2002. 03. 20그래픽스 연구실
정병선
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (1/12)
Notation Name
T(t) translation matrix
Rx(ρ) rotation matrix
R rotation matrix
S(s) scaling matrix
Hij(s) shear matrix
E(h,p,r) Euler transform
Po(s) orthographic projection
Pp(s) perspective projection
slerp(q,r,t) slerp transform
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (2/12)
Translation matrix
example
)()(,
1000
100
010
001
),,()( 1 tTtTt
t
t
tttTtTz
y
x
zyx
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (3/12)
Rotation matrix
)(,
1000
0100
00cossin
00sincos
)(
)(,
1000
0cos0sin
0010
0sin0cos
)(
)(,
1000
0cossin0
0sincos0
0001
)(
1
1
1
zz
yy
xx
RR
RR
RR
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (4/12)
example
)()()( pTRpTX z
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (5/12)
Scaling matrix
example scaling in a certain direction
1000
01
00
001
0
0001
)(,
1000
000
000
000
)( 1
z
y
x
z
y
x
s
s
s
sSs
s
s
sS
T
zyx
zyx
FsFSX
vectorsorientedrightlorthonormathefff
fffF
)(
:,,
1000
0
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (6/12)
Shearing matrix
6 basic shearing matrices
)()(,
1000
0100
0010
001
)( 1 sHsH
s
sH xzxzxz
)(),(),(),(),(),( sHsHsHsHsHsH zyzxyzyxxzxy
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (7/12)
example
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (8/12)
Concatenation of transforms example
Rotating a unit-square π/6 radians by shearing three times
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (9/12)
Order dependency multiplication of matrices is not commutative. C = TRS example
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (10/12)
Rigid-body transform the shape of the object is not affected by transform. so, this transform consists of translations and
rotations. matrix
)()())((
1000
)(
1111
222120
121110
020100
tTRtTRRtTX
trrr
trrr
trrr
RtTX
T
x
x
x
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (11/12)
Normal transform The surface normal must be transformed by the
transpose of the inverse of the matrix used to transform geometry.
example
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Basic Transforms (12/12)
Computation of inverses inversion of parameters
M = T(t)R(Φ) → M-1 = R(- Φ)T(-t)
orthogonal matrix M-1 = MT
nothing in particular Cramer’s rule Gaussian elimination