Mathematics For Computer Graphics: CGVR - Korea.ac - KR
Mathematics For Computer Graphics: CGVR - Korea.ac - KR
cgvr.korea.ac.kr
Mathematics for
Computer Graphics
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Contents
Coordinate-Reference Frames
2D Cartesian Reference Frames / Polar Coordinates
3D Cartesian Reference Frames / Curvilinear Coordinates
Points and Vectors
Vector Addition and Scalar Multiplication
Scalar Product / Vector Product
Basis Vectors and the Metric Tensor
Orthonormal Basis
Metric Tensor
Matrices
Scalar Multiplication and Matrix Addition
Matrix Multiplication / Transpose
Determinant of a Matrix / Matrix Inverse
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Coordinate Reference Frames
Coordinate Reference Frames
Cartesian coordinate system
x, y, z ,
Non-Cartesian coordinate system
object .
Polar, Spherical, Cylindrical
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
2D Cartesian Reference
System
2D Cartesian Reference Frames
Coordinate origin at the
lower-left screen corner
y
x
y
x
Coordinate origin in the
upper-left screen corner
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Polar Coordinates
Non-Cartesian System
Elliptical Coordinates, Hyperbolic or Parabolic
Plane Coordinates Symmetry
2
u u sin , cos r y r x = =
|
.
|
\
|
= + =
x
y
y x r
1 2 2
tan , u
u r s =
u
r
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Why Polar Coordinates?
x
x
y
y
dx
dx
du
du
Polar Coordinates
Cartesian Coordinates
2 2 2
r y x = +
u =
u =
sin
, cos
r y
r x
Circle
2D Cartesian :
Polar Coordinate
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
3D Cartesian Reference
Frames
Three Dimensional Point
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
3D Cartesian Reference
Frames
Graphics
Package
Video Monitor
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
3D Curvilinear Coordinate
Systems
General Curvilinear Reference Frame
Orthogonal coordinate system
Each coordinate surfaces intersects at right angles
A general Curvilinear coordinate reference frame
x
2
axis
x
3
axis x
1
axis
x
1
= const
1
x
3
= const
3
x
2
= const
2
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
3D Non-Cartesian System
Cylindrical Coordinates Spherical Coordinates
z
P(,u,z)
x axis
y axis
z axis
u
P(r,u, )
x axis
y axis
z axis
u
|
r
u cos = x
u sin = y
z z =
| u sin cos r x =
| u sin sin r y =
| cos r z =
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Point: ,
Vector: position
Magnitude Direction
) , ( ) , (
1 2 1 2 1 2 y x
V V y y x x P P V = = =
V
P
2
P
1
x
1
x
2
y
1
y
2
2 2
y x
V V V + =
|
|
.
|
\
|
=
x
y
V
V
1
tan o
Points and Vectors
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Vectors
3 Vector
Vector Addition and Scalar Multiplication
2 2 2
z y x
V V V V + + =
| |
cos ,
| |
cos ,
| |
cos
V
V
V
V
V
V
z
y
x
= = = | o
1 cos cos cos
2 2 2
= + + | o
o
|
V
x
z
y
) , , (
2 1 2 1 2 1 2 1 z z y y x x
V V V V V V V V + + + = +
) , , (
z y x
V V V V o o o o =
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Scalar Product
Definition
For Cartesian Reference Frame
Properties
Commutative
Distributive
|V
2
|cosu
u
V
2
V
1
t u u s s = 0 , cos | || |
2 1 2 1
V V V V
Dot Product, Inner Product
z z y y x x
V V V V V V V V
2 1 2 1 2 1 2 1
+ + =
1 2 2 1
V V V V =
3 1 2 1 3 2 1
) ( V V V V V V V + = +
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Vector Product
Definition
For Cartesian Reference Frame
Properties
AntiCommutative
Not Associative
Distributive
t u u s s = 0 , sin | || |
2 1 2 1
V V V V u
) , , (
2 1 2 1 2 1 2 1 2 1 2 1 2 1 x y y x z x x z y z z y
V V V V V V V V V V V V V V =
Cross Product, Outer Product
V
1
V
2
V
1
V
2
u
u
) (
1 2 2 1
V V V V =
3 2 1 3 2 1
) ( ) ( V V V V V V =
) ( ) ( ) (
3 1 2 1 3 2 1
V V V V V V V + = +
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Examples
Scalar Product Vector Product
Normal Vector of the Plane
u
V
2
V
1
Angle between Two Edges
(x
2
,y
2
)
(x
0
,y
0
)
(x
1
,y
1
)
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Basis Vectors
Basis (or a Set of Base Vectors)
Specify the coordinate axes in any reference frame
Linearly independent set of vectors
Any other vector in that space can be written as
linear combination of them
Vector Space
Contains scalars and vectors
Dimension: the number of
base vectors
Curvilinear coordinate-
axis vectors
u
2
u
1
u
3
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Orthonormal Basis
Normal Basis + Orthogonal Basis
Example
Orthonormal basis for 2D Cartesian reference frame
Orthonormal basis for 3D Cartesian reference frame
k j
k
k j
k k
= =
=
all for , 0
all for , 1
u u
u u
( ) ( ) 1 , 0 0 , 1 = =
y x
u u
( ) ( ) ( ) 1 , 0 , 0 0 , 1 , 0 0 , 0 , 1 = = =
z y x
u u u
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Metric Tensor
Tensor
Quantity having a number of components, depending
on the tensor rank and the dimension of the space
Vector tensor of rank 1, scalar tensor of rank 0
Metric Tensor for any General Coordinate
System
Rank 2
Elements:
Symmetric:
k j jk
g u u =
kj jk
g g =
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Properties of Metric Tensors
The Elements of a Metric Tensor can be
used to Determine
Distance between two points in that space
Transformation equations for conversion to another
space
Components of various differential vector
operators (such as gradient, divergence, and curl)
within that space
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Examples of Metric Tensors
Cartesian Coordinate System
Polar Coordinates
=
=
otherwise , 0
if , 1 k j
g
jk
( ) ( ) 1 , 0 0 , 1 = =
y x
u u
u u
u u
u
cos sin
, sin cos
r r
y x
y x r
u u u
u u u
+ =
+ =
(
=
2
0
0 1
r
g
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Matrices
Definition
A rectangular array of quantities
Scalar Multiplication and Matrix Addition
(
(
(
(
=
mn m m
n
n
a a a
a a a
a a a
A
...
: : :
...
...
2 1
2 22 21
1 12 11
|
|
.
|
\
|
=
|
|
.
|
\
|
=
22 21
12 11
22 21
12 11
,
b b
b b
B
a a
a a
A
|
|
.
|
\
|
+ +
+ +
= +
22 22 21 21
12 12 11 11
b a b a
b a b a
B A
|
|
.
|
\
|
=
22 21
12 11
ka ka
ka ka
kA
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Matrix Multiplication
Definition
Properties
Not Commutative
Associative
Distributive
Scalar Multiplication
=
(i,j)
j-th column
i-th row
m
l
n
n
m
l
=
=
n
k
kj ik ij
b a c
1
AB C =
BA AB=
) ( ) ( BC A C AB =
BC AB C B A + = + ) (
) ( ) ( ) ( AB k kB A B kA = =
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Matrix Transpose
Definition
Interchanging rows and columns
Transpose of Matrix Product
| |
(
(
(
=
(
(
(
=
(
c
b
a
c b a
T
T
,
6 3
5 2
4 1
6 5 4
3 2 1
( )
T T
T
A B AB =
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Determinant of Matrix
Definition
For a square matrix, combining the matrix
elements to product a single number
2 2 matrix
Determinant of nn Matrix A (n >2)
=
+
=
n
j
jk jk
k j
a
1
det ) 1 ( det A A
21 12 22 11
22 21
12 11
a a a a
a a
a a
=
CGVR
GraphicsLab@KoreaUniversity
cgvr.korea.ac.kr
Inverse Matrix
Definition
Non-singular matrix
If and only if the determinant of the matrix is non-zero
2 2 matrix
Properties
I A A I AA = =
1 1
T T
) A ( ) A ( A B ) AB ( A ) A (
1 1 1 1 1 1 1
= = =
(
a c
b d
bc ad
A
1
1
(
=
d c
b a
A