mathematics for computer graphics (appendix a) 2001. 1. 10 won-ki jeong
TRANSCRIPT
Mathematics for Computer Graphics
(Appendix A)
2001. 1. 10Won-Ki Jeong
A-1. Coordinate Reference Frame
2D Cartesian reference frame
x
y
x
y
2D Polar Coordinate reference frame
r
r
x
y
x
yyxr
ryrx
122 tan,
sin,cos
s
r
P
radianr
rr
sradian
22
360
3D Cartesian reference frame
Right-handed v.s left-handed
y
xz
y
x
z
Right-handed Left-handed
3D curvilinear coordinate systems
General curvilinear reference frame Orthogonal coordinate system
Each coordinate surfaces intersects at right angles
axisX1
axisX 2
axisX 3
Cylindrical-coordinate
: vertical cylinder
: vertical plane containing z-axis
: horizontal plane parallel to xy-plane
z
constant
zz
y
x
sin
cos
Transform to Cartesian coordinator
z
x axis
y axis
z axis
),,( zP
Spherical-coordinate
x axis
y axis
z axis
),,( rP
: sphere
: vertical plane containing z-axis
: cone with the apex at the origin
r
constant
cos
sinsin
sincos
rz
ry
rx
Transform to Cartesian coordinator
r
Solid angle
3D Angle defined on a sphere(steradian)
r
A
2r
ASteradian :
Total solid angle :
44
2
2
2
r
r
r
Asteradian
A-2. Points & Vectors
Point Position in some reference frame Distance from the origin depends on the
reference frame
PFrame B
Frame Ax
y
AO
BO
Vector Difference between two point positions Properties : Magnitude & direction
Same properties within a single coordinate system
Magnitude is independent from coordinate frames
12 PPV
),(
),( 1212
yx VV
yyxx
22yx VVV Magnitude :
x
y
V
V1tanDirection :
3D vector
Magnitude
Directional angle
222zyx VVVV
x
y
z
V
V
V
V
V
V zyx cos,cos,cos
1coscoscos 222
Vector addition &scalar multiplication
Addition
Scalar multiplication
),,( 21212121 zzyyxx VVVVVVVV
1V
2V 2V
1V
21 VV
),,( 1111 zyx aVaVaVaV
Vector multiplication
Scalar product(inner product)
zzyyxx VVVVVV 212121
cos2121 VVVV Commutative :
Distributive :
1221 VVVV
3121321 )( VVVVVVV
Orthogonal : 021 VV
1V
2V
cos2V
Vector product(Cross product)
),,( 212121212121 xyyxzxxzyzzy VVVVVVVVVVVV
sin2121 VVuVV
zyx
zyx
zyx
VVV
VVV
uuu
222
111
Noncommutative :
Nonassociative :
Distributive :
1221 VVVV
3121321 )( VVVVVVV 3121321 )( VVVVVVV
21 VV 2V
1V
uRight-handed rule!
A-3. Basis vectors and the metric tensor
Basis of vector space Linearly independent axis vectors
Orthonormal basis Orthogonal : Normalized : Orthonormal = Orthogonal + Normalized Orthonormal basis of 3D Cartesian reference frame
1u
2u 3u
1u
2u
3u
)1,0,0()0,1,0()0,0,1( zyx uuu
kjallforuu kj 0
1 kk uu
Metric tensor
Tensor Generalization of a vector with rank & dim. that satisfy c
ertain transformation properties n-th rank with dim m : m-dimensional space which has
n indices Rank 0: scalar, rank 1: dim m vector
rank 2 : vector which has m2 componentMetric tensor Definition : The tensor for
Distance metric Used as transformation equation Component of differential vector operators (gradient, di
vergence, and curl)
kjjk uug
Example of metric tensor
Cartesian coordinate system
Polar coordinates
0
1jkg
If j = k
otherwise
22222112
2111
2 dxgdxdxgdxgdsPythagorean theorem :
22
21
2 dxdxds
22
22
21 dxdxdxds For 3D Cartesian coordinate
system :
cossin
sincos
ruruu
uuu
yx
yxr
20
01
rg
A-4. Matrices
Rows & columns
Matrix multiplication
mnmm
n
n
aaa
aaa
aaa
A
21
22221
11211
Column
row
n
kkjikij bac
1ABC
ACABCBA
BAAB
)(
Properties
Transpose & Determinant
Matrix transpose
Determinant
Large matrix A
63
52
41
654
321T
TTT ABAB )(
n
jjkik
kj AaA1
det)1(det211222112221
1211 aaaaaa
aa
LUA
nnnn dlll
dll
dl
d
L
321
33231
221
1
00
000
0000
n
n
n
n
e
ue
uue
uuue
U
000
00
0
33
2232
113121
))(det(det)det(det ULLUA ))(( 2121 nn eeeddd
Inverse of a matrix
Inverse matrix Determinant is not 0 : Non-singular matrix
Elements of
IAAAA 11
1A
A
A
jkkj
kj
a det
det)1(1
A-5. Complex numbers
Real + Imaginary partiyxyxz ),(
Real axis
Imaginary axis
x
y12 i
)(),( 221121 yxyxzz
),( 2121 yyxx ),)(,( 221121 yxyxzz
),( 12212121 yxyxyyxx
iyxz 22 yxzzz
22
22
211222
22
212122
22
2211
22
21
2
1 ,),)(,(
yx
yxyx
yx
yyxx
yx
yxyx
zz
zz
z
z
Polar form & Euler’s formula
Polar form
Euler’s formula
Real axis
Imaginary axis
x
y
r
),( yxz )sin(cos irz
)sin(cos irrez i )(2121
21 ierrzz
)(
2
1
2
1 21 ier
r
z
z
n
ki
n
krz nn 2
sin2
cos
A-6. Quaternions
Higher dimension complex number
Addition, multiplication, magnitude, & inverse
kcjbiasq 1222 kji
jikkiikjjkkjiij ,,
)()()()( 2121212121 cckbbjaaissqq
),( 211221212121 vvvsvsvvssqq ),( vsq
vvsq 22),(
12
1 vsq
q )0,1(11 qqqq
A-7. Nonparameteric representation
Direct description in terms of the reference frame Surface : or Curve : Useful in the given reference frame
Example (circle)
0),,( zyxf ),( yxfz )(),( xgzxfy
222 ryx 22 xry
Implicit form
Explicit form
A-8. Parameteric representation
Use parameter domain Curve
Ex. Circle
Surface
Ex. Spherical surface
))(),(),(()( uzuyuxuP
0)(),2sin()(),2cos()( uzuruyurux
)),(),,(),,((),( vuzvuyvuxvuP
)cos(),(
)2sin()sin(),(
)2cos()sin(),(
urvuz
vurvuy
vurvux
r : radius of the sphere
u: latitudev: longitude
A-9. Numerical methods
Solving sets of linear equation Matrix form
Cramer’s rule Adequate for a few variables
nnnnnn
nn
nn
bxaxaxa
bxaxaxa
bxaxaxa
2211
22222121
11212111
BAX
BAX1
A
Ax k
k det
det kA : matrix A with the kth column replaced
with B
Gauss elimination Elementary Row Operation
Multiply a row through by a nonzero constant Interchange two rows Add a multiple of one row to another row
Make row-echelon form by e.r.o Row-echelon form
First nonzero number of each row is 1(leading 1)
Entire-zero-rows are grouped together at the bottom of the matrix
In any successive non-entire-zero rows, the leading 1 in the lower row occurs farther to the right than the leading 1 in the higher row
Gauss-Seidel method Start with initial guess and repeatedly calculate su
ccessive approximations until their difference is small
Convergence condition Each diagonal element of a matrix A has a magnitude greater
than the sum of the magnitudes of the other elements across that row
12
121211122
11
131321211
a
xaxaxabx
a
xaxaxabx
nn
nn
Finding roots of nonlinear equation
Object Finding the solution of
Newton-Raphson algorithm Iterative approximation Fast, but it may be fail to converge
0)( xf
10
0 )(
xx
xf
dx
df
)(
)(
0
001 xf
xfxx
0x1x
Initial guess
Bisection method Convergence guaranteed
0x1x0x 2x3x
Evaluating integrals
Rectangle approximation
Polynomial approximation Simpson’s rule
a
b
n
kkk xxfdxxf
1
)()(
ax 0 bxn
a
b
n
kodd
n
kevenkk xfxfbfaf
xdxxf
1
1
2
2
)(2)(4)()(3
)(
nkxxxaxn
abx kk ,......,2,1,,, 10
Monte Carlo method For high-frequency oscillation function or
multiple integrals Use random positions : uniformly
distributedmaxy
miny
maxy
miny
b
a
count
n
nabhdxxf )()(
: # of random points between f(x) and x-axiscountn hryy
abrax
yyh
2min
1
minmax
),(
,
Given two random number r1 and r2 :
Fitting curves to data sets Least-squares algorithm
Fitting a function to a set of data points Ex. 2D linear case
2
1
)(
n
kkk xfyE
xaaxf 10)( 0,010
a
E
a
E
Solve linear equation!
),(,),,(),,( 2211 kk yxyxyx
kx
ky
)( kxf