graphics graphics lab @ korea university cgvr.korea.ac.kr mathematics for computer graphics...

25
Graphics cgvr.korea.ac.kr Graphics Lab @ Korea University Mathematics for Computer Graphics 고고고고고 고고고 고고고고 고고고

Post on 22-Dec-2015

268 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

Graphics

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

Mathematics for Computer Graphics

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

Page 2: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

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

Page 3: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Coordinate Reference Frames

Coordinate Reference Frames Cartesian coordinate system

x, y, z 좌표축사용 , 전형적 좌표계

Non-Cartesian coordinate system 특수한 경우의 object 표현에 사용 .

Polar, Spherical, Cylindrical 좌표계 등

Page 4: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

2D Cartesian Reference System

2D Cartesian Reference Frames

Coordinate origin at the lower-left screen corner

y

xy

x

Coordinate origin in the upper-left screen corner

Page 5: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Polar Coordinates

가장 많이 쓰이는 Non-Cartesian System

Elliptical Coordinates, Hyperbolic or Parabolic

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

sin,cos ryrx

x

yyxr 122 tan,

rs

r

Page 6: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Why Polar Coordinates?

x x

y y

dxdx

dd

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

Polar CoordinatesCartesian Coordinates

222 ryx

sin

,cos

ry

rx

Circle 2D Cartesian : 비균등 분포 Polar Coordinate

Page 7: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

3D Cartesian Reference Frames

Three Dimensional Point

Page 8: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

3D Cartesian Reference Frames

오른손 좌표계 대부분의 Graphics Packa

ge 에서 표준

왼손 좌표계 관찰자로부터 얼마만큼

떨어져 있는지 나타내기에 편리함

Video Monitor 의 좌표계

Page 9: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

3D Curvilinear Coordinate Systems

General Curvilinear Reference Frame Orthogonal coordinate system

Each coordinate surfaces intersects at right angles

A general Curvilinear coordinate reference frame

x2 axis

x3 axis x1 axis

x1 = const1

x3 = const3

x2 = const2

Page 10: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

3D Non-Cartesian System

Cylindrical Coordinates Spherical Coordinates

z

P(,,z)

x axis

y axis

z axis

P(r,, )

x axis

y axis

z axis

r

cosx siny

zz

sincosrx sinsinry

cosrz

Page 11: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

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

Vector: 두 position 간의 차로 정의

Magnitude 와 Direction 으로도 표기

),(),( 121212 yx VVyyxxPPV

V

P2

P1

x1 x2

y1

y222

yx VVV

x

y

V

V1tan

Points and Vectors

Page 12: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Vectors

3 차원에서의 Vector

Vector Addition and Scalar Multiplication

222zyx VVVV

||cos,

||cos,

||cos

V

V

V

V

V

V zyx

1coscoscos 222

V

x

z

y

),,( 21212121 zzyyxx VVVVVVVV

),,( zyx VVVV

Page 13: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Scalar Product

Definition

For Cartesian Reference Frame

Properties Commutative

Distributive

|V2|cos

V2

V1

0,cos|||| 2121 VVVV

Dot Product, Inner Product 라고도 함

zzyyxx VVVVVVVV 21212121

1221 VVVV

3121321 )( VVVVVVV

Page 14: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Vector Product

Definition

For Cartesian Reference Frame

Properties AntiCommutative Not Associative Distributive

0,sin|||| 2121 VVVV u

),,( 21212121212121 xyyxzxxzyzzy VVVVVVVVVVVVVV

Cross Product, Outer Product 라고도 함V1

V2

V1 V2

u

)( 1221 VVVV

321321 )()( VVVVVV )()()( 3121321 VVVVVVV

Page 15: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Examples

Scalar Product Vector Product

Normal Vector of the Plane

V2

V1

Angle between Two Edges

(x2,y2)

(x0,y0)(x1,y1)

Page 16: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

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 vectorsCurvilinear coordinate-

axis vectors

u2

u1

u3

Page 17: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Orthonormal Basis

Normal Basis + Orthogonal Basis

Example Orthonormal basis for 2D Cartesian reference frame

Orthonormal basis for 3D Cartesian reference frame

kj

k

kj

kk

allfor ,0

allfor ,1

uu

uu

1 ,00 ,1 yx uu

1 ,0 ,00 ,1 ,00 ,0 ,1 zyx uuu

Page 18: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

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:

kjjkg uu kjjk gg

Page 19: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

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

Page 20: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Examples of Metric Tensors

Cartesian Coordinate System

Polar Coordinates

otherwise,0

if,1 kjg jk

1 ,00 ,1 yx uu

cossin

,sincos

rr yx

yxr

uuu

uuu

20

01

rg

Page 21: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Matrices

Definition A rectangular array of quantities

Scalar Multiplication and Matrix Addition

mnmm

n

n

aaa

aaa

aaa

A

...

:::

...

...

21

22221

11211

2221

1211

2221

1211 ,bb

bbB

aa

aaA

22222121

12121111

baba

babaBA

2221

1211

kaka

kakakA

Page 22: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Matrix Multiplication

Definition

Properties Not Commutative Associative Distributive Scalar Multiplication

× = (i,j)

j-th column

i-th row

ml

nnm

l

n

kkjikij bac

1

ABC

BAAB )()( BCACAB

BCABCBA )()()()( ABkkBABkA

Page 23: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Matrix Transpose

Definition Interchanging rows and columns

Transpose of Matrix Product

c

b

a

cba T

T

,

63

52

41

654

321

TTT ABAB

Page 24: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

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

jjkjk

kj a1

det)1(det AA

211222112221

1211 aaaaaa

aa

Page 25: Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

Graphics Lab @ Korea University

Inverse Matrix

Definition

Non-singular matrix If and only if the determinant of the matrix is non-zero

2 2 matrix

Properties

IAAIAA 11

TT )A()A(AB)AB(A)A( 1111111

ac

bd

bcadA

11

dc

baA