You are on page 1of 25

Graphics

Mathematics for
Computer Graphics

고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr Graphics Lab @ Korea University


Contents
CGVR

 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.korea.ac.kr Graphics Lab @ Korea University


Coordinate Reference Frames
CGVR

 Coordinate Reference Frames


 Cartesian coordinate system
 x, y, z 좌표축사용 , 전형적 좌표계

 Non-Cartesian coordinate system


 특수한 경우의 object 표현에 사용 .
 Polar, Spherical, Cylindrical 좌표계 등

cgvr.korea.ac.kr Graphics Lab @ Korea University


2D Cartesian Reference
System CGVR

 2D Cartesian Reference Frames

y x

y
x

Coordinate origin at the Coordinate origin in the


lower-left screen corner upper-left screen corner

cgvr.korea.ac.kr Graphics Lab @ Korea University


Polar Coordinates
CGVR

 가장 많이 쓰이는 Non-Cartesian System

r x  r cos , y  r sin 
 y
 r  x2  y2 ,   tan 1  
 x
s  r

 Elliptical Coordinates, Hyperbolic or Parabolic


Plane Coordinates 등 원 이외에 Symmetry 를
가진 다른 2 차 곡선들로도 좌표계 표현 가능

cgvr.korea.ac.kr Graphics Lab @ Korea University


Why Polar Coordinates?
CGVR

 Circle
 2D Cartesian : 비균등 분포
 Polar Coordinate
x  r cos ,
y x2  y2  r 2 y
y  r sin 

d
d
x x
dx dx

균등하게 분포되지 않은 점들 연속된 점들 사이에 일정간격유지

Cartesian Coordinates Polar Coordinates

cgvr.korea.ac.kr Graphics Lab @ Korea University


3D Cartesian Reference
Frames CGVR

Three Dimensional Point

cgvr.korea.ac.kr Graphics Lab @ Korea University


3D Cartesian Reference
Frames CGVR

 오른손 좌표계
 대부분의 Graphics Packa
ge 에서 표준

 왼손 좌표계
 관찰자로부터 얼마만큼
떨어져 있는지 나타내기에
편리함
 Video Monitor 의 좌표계

cgvr.korea.ac.kr Graphics Lab @ Korea University


3D Curvilinear Coordinate
Systems CGVR

 General Curvilinear Reference Frame


 Orthogonal coordinate system
 Each coordinate surfaces intersects at right angles
x2 axis

x3 = const3
x1 = const1

x3 axis x2 = const2 x1 axis

A general Curvilinear coordinate reference frame


cgvr.korea.ac.kr Graphics Lab @ Korea University
3D Non-Cartesian System
CGVR

 Cylindrical Coordinates  Spherical Coordinates

z z axis z axis

P(,,z) P(r,, )

r
y axis  y axis
 
x axis x axis

x   cos x  r cos sin 


y   sin  y  r sin  sin 
zz z  r cos 

cgvr.korea.ac.kr Graphics Lab @ Korea University


Points and Vectors
CGVR

 Point: 좌표계의 한 점을 차지 , 위치표시


 Vector: 두 position 간의 차로 정의
V  P2  P1  ( x2  x1 , y2  y1 )  (Vx ,V y )

 Magnitude 와 Direction 으로도 표기

y2 P2 V  Vx2  V y2
V
y1  Vy 
P1   tan 
1 

 Vx 
x1 x2

cgvr.korea.ac.kr Graphics Lab @ Korea University


Vectors
CGVR

 3 차원에서의 Vector
z

V  Vx2  V y2  Vz2
 V
V Vy V
cos  x , cos   , cos   z 
|V | |V | |V |  y
cos 2   cos 2   cos 2   1 x

 Vector Addition and Scalar Multiplication


V1  V2  (V1x  V2 x , V1 y  V2 y , V1z  V2 z )

V  (Vx ,V y , Vz )

cgvr.korea.ac.kr Graphics Lab @ Korea University


Scalar Product
CGVR

 Definition
V2
V1  V2 | V1 || V2 | cos , 0    

V1
|V2|cos Dot Product, Inner Product 라고도 함

 For Cartesian Reference Frame


V1 V2  V1xV2 x  V1 yV2 y  V1zV2 z
 Properties
 Commutative V1  V2  V2  V1
 Distributive V1  (V2  V3 )  V1  V2  V1  V3

cgvr.korea.ac.kr Graphics Lab @ Korea University


Vector Product
CGVR

 Definition

V1  V2 V1  V2  u | V1 || V2 | sin  , 0    
V2
u  Cross Product, Outer Product 라고도 함
V1
 For Cartesian Reference Frame
V1  V2  (V1 yV2 z  V1zV2 y ,V1zV2 x  V1xV2 z ,V1xV2 y  V1 yV2 x )
 Properties
 AntiCommutative
V1  V2  (V2  V1 )
 Not Associative
V1  (V2  V3 )  (V1  V2 )  V3
 Distributive
V1  (V2  V3 )  (V1  V2 )  (V1  V3 )
cgvr.korea.ac.kr Graphics Lab @ Korea University
Examples
CGVR

 Scalar Product  Vector Product


(x2,y2)

V2


(x1,y1)
(x0,y0) V1

Angle between Two Edges Normal Vector of the Plane

cgvr.korea.ac.kr Graphics Lab @ Korea University


Basis Vectors
CGVR

 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
u2
 Vector Space
 Contains scalars and vectors u1
 Dimension: the number of
u3
base vectors
Curvilinear coordinate-
axis vectors
cgvr.korea.ac.kr Graphics Lab @ Korea University
Orthonormal Basis
CGVR

 Normal Basis + Orthogonal Basis


u k  u k  1, for all k
u j  u k  0, for all j  k

 Example
 Orthonormal basis for 2D Cartesian reference frame
u x  1, 0 u y   0, 1
 Orthonormal basis for 3D Cartesian reference frame
u x  1, 0, 0 u y   0, 1, 0 u z   0, 0, 1

cgvr.korea.ac.kr Graphics Lab @ Korea University


Metric Tensor
CGVR

 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: g jk  u j  u k
 Symmetric: g jk  g kj

cgvr.korea.ac.kr Graphics Lab @ Korea University


Properties of Metric Tensors
CGVR

 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.korea.ac.kr Graphics Lab @ Korea University


Examples of Metric Tensors
CGVR

 Cartesian Coordinate System


u x  1, 0 u y   0, 1
1, if j  k
g jk  
0, otherwise
 Polar Coordinates
u r  u x cos   u y sin  ,
u  u x r sin   u y r cos 
1 0 
g 2
 0 r 
cgvr.korea.ac.kr Graphics Lab @ Korea University
Matrices
CGVR

 Definition
 A rectangular array of quantities
 a11 a12 ... a1n 
a a22 ... a2 n 
A   21
 : : : 
 
am1 am 2 ... amn 
 Scalar Multiplication and Matrix Addition
 a11  b11 a12  b12 
A  B   
 a11
A  
a12   b11 b12 
 , B     a21  b21 a22  b22 
 a21 a22   b21 b22   ka11 ka12 
kA   
 ka21 ka22 
cgvr.korea.ac.kr Graphics Lab @ Korea University
Matrix Multiplication
CGVR

 Definition
j-th column
C  AB i-th row
m
n l × = l (i,j)
cij   aik bkj
m n
k 1
n
 Properties
 Not Commutative AB  BA
 Associative ( AB )C  A( BC )
 Distributive A( B  C )  AB  BC
 Scalar Multiplication ( kA) B  A( kB )  k ( AB )

cgvr.korea.ac.kr Graphics Lab @ Korea University


Matrix Transpose
CGVR

 Definition
 Interchanging rows and columns
T 1 4  a 
1 2 3 2 5,
 4 5 6     a b cT  b 
  3 6  c 
 Transpose of Matrix Product

 AB  T  BT A T

cgvr.korea.ac.kr Graphics Lab @ Korea University


Determinant of Matrix
CGVR

 Definition
 For a square matrix, combining the matrix
elements to product a single number
 2  2 matrix
a11 a12
 a11a22  a12 a21
a21 a22
 Determinant of nn Matrix A (n 2)
n
det A   (1) j  k a jk det A jk
j 1

cgvr.korea.ac.kr Graphics Lab @ Korea University


Inverse Matrix
CGVR

 Definition 1 1
AA  I A A I
 Non-singular matrix
 If and only if the determinant of the matrix is non-zero
 2  2 matrix
a b  1 1  d  b
A A 
 c d 
 ad  bc  c a 
 Properties
( A1 )1  A ( AB )1  B 1 A1 ( AT )1  ( A1 )T

cgvr.korea.ac.kr Graphics Lab @ Korea University

You might also like