59
Mathmatics for Computer Graphics A r

Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents Spaces Vectors and Linear combination Affine Combination Coordinate-reference

Embed Size (px)

DESCRIPTION

Mathematics for Computer Graphics Vector Spaces oA nonempty set V of vectors  Vectors have magnitude and direction. oAddition + Scalar Multiplication · u+v = v+u  V · (u+v)+w = u+(v+w) · u+0 = u · u+(-u) = 0 · cu  V,(c is scalar) · c(u+v) = cu+cv · (c+d)u = cu+du · c(du) = (cd)u · 1u = u Directed Line Segments … but, have no position ! Identical Vectors

Citation preview

Page 1: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathmatics for Computer Graphics

A r

Page 2: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Contents

Spaces Vectors and Linear combination Affine Combination Coordinate-reference Frames Points and Lines Parametric Representation Linear Transformation Homogeneous Coordinates

Page 3: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Vector Spaces A nonempty set V of vectors Vectors have magnitude and direction. Addition + Scalar Multiplication · u+v = v+u V · (u+v)+w = u+(v+w)

· u+0 = u · u+(-u) = 0 · cu V ,(c is scalar) · c(u+v) = cu+cv · (c+d)u = cu+du · c(du) = (cd)u · 1u = u

Directed Line Segments

… but, have no position !

Identical Vectors

Page 4: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Affine Spaces

e3

e1

e2 e3

e1e2

Basis vectors located at the origin

Introducing the concepts of “points”,which represents “the location”

Truncated plane (No Origin): Vector Space

P 기준의 새 좌표계 설정: Affine Space

P

Contain the necessary elements for building geometric models

Points 와 그에 종속된 Vector 들로 표현

Page 5: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Euclidean Spaces

Affine spaces have no concepts of how far apart two points are, or of what the length of a vector is

To Support a measure of distance between points,such as,..Inner Product!

)()( QPQPQP

Page 6: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Points and Vectors Point : 좌표계의 한 점을 차지 , 위치표시 Vector : 두 position 간의 차로 정의

Magnitude 와 Direction 으로도 표기),(),( 121212 yx VVyyxxPPV

VP2

P1

x1 x2

y1

y222

yx VVV

x

y

VV1tan

Page 7: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Vectors (계속 ) 3 차원에서의 Vector

Vector Addition and Scalar Multiplication

222zyx VVVV

||cos,

||cos,

||cos

VV

VV

VV zyx

1coscoscos 222

V

x

z

y

),,( 21212121 zzyyxx VVVVVVVV

),,( zyx VVVV

Page 8: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Scalar Product

|V2|cos

V2

V1

0,cos|||| 2121 VVVV

Dot Product, Inner Product 라고도 함

For Cartesian reference frame,

zzyyxx VVVVVVVV 21212121

Some PropertiesCommutative

Distributive1221 VVVV

3121321 )( VVVVVVV

Page 9: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Scalar Product (계속 )

V2

V1

Edge 사이의 사잇각 Polygon 의 면적(x0,y0,z0)

(x1,y1,z1)(x2,y2)

(x0,y0)

(x2,y2,z2)(x1,y1)

Page 10: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Vector Product

0,sin|||| 2121 VVuVV

V1

V2

V1 V2

),,( 21212121212121 xyyxzxxzyzzy VVVVVVVVVVVVVV

※ ux,uy,uz 를 각 축의 단위 vector 라 하면 ,

zyx

zyx

zyx

VVVVVVuuu

VV

222

11121

PropertiesAntiCommutative

Not Assotiative

Distributive

)( 1221 VVVV

321321 )()( VVVVVV

)()()( 3121321 VVVVVVV

Page 11: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Vector Product (계속 )

Shading, Reflection Model 평면사이의 위치관계

Page 12: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Vector Spaces

A nonempty set V of vectors

Addition + Scalar Multiplication

· u+v = v+u V · (u+v)+w = u+(v+w) · u+0 = u · u+(-u) = 0 · cu V ,(c is scalar) · c(u+v) = cu+cv · (c+d)u = cu+du · c(du) = (cd)u · 1u = u

Page 13: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Linear Combination Consist of scalar and vectors

nn2211 v...vv

vv

v

: real number : nonnegative

Ex) Single Vector 의 linear combination

Page 14: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Span

v1

v2

v1 +v2

Ex) Span{v1,v2}

두 Vector 의 linear combination

Span Vector set 의 모든 가능한 linear combination 을 지칭

Page 15: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Linearly Independence A set of vectors B={v1,…,vp} in V is said to be linearly independe

nt if the vector equation

has only the trivial solution c1=0,…,cp=0.

0...2211 ppvcvcvc

uw

v

u

w

v

Linearly dependent,w in Span{u,v}

Linearly independent,w not in Span{u,v}

(6,2)(3,1)

Linearly dependent, Collinear

(6,2)(3,2)

Linearly independent, Not collinear

Page 16: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Basis

어떤 linearly independent vector set B 에 의해 vector space H 가 span 될 때 , 이 vector set B 를 H 의 basis 라 한다 .

100

u,010

u,001

u 321

z

x

yu1 u2

u3

The standard basis for R3

H = Span{b1, … ,bp}

Page 17: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Orthogonal Basis Orthogonal basis

- 각 원소 vector 들이 서로 직교 할 때- ,1 kk uu for all k

,0 kj uu for all j k

-

kk

kkkkkk vv

vycvyvvc

yvcvcvc pp ...2211

z

x

yu1 u2

u3

Orthonormal basis

※ Orthonormal basis 각 원소 vector 들이 서로 직교 하면서 동시에 단위 vector 로 이루어져 있을 때

kkpp vyvvcvcvc )...( 2211

Page 18: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Affine Space

The Extension of the Vector Space

Geometric operation 들이 의미를 갖는 공간

Points 와 그에 종속된 vector 들로 표현

Truncated plane (No Origin): Vector Space

P 기준의 새 좌표계 설정: Affine Space

P

Page 19: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Affine Combination

Linear combination of points in an affine space make no sense (Operations on the points are limited)

Using Parametric Representation

)( 12 PPt

)( 121 PPtP

1P

2P)( 121 PPtPP

Line segment joining P1and P2, if 0 t 1

21)1( tPPtP

2211 PPP Affine combination of two points

1, 21

Page 20: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Affine Combination

nnPPPP ...2211

2P

3P1P

P

)( 133 PP

)( 122 PP

One Example of Affine Combination

Generalized form

1..., 21 n

33211 PPPP 1, 321

gives a point in the triangle.

)()( 1331221 PPPPPP

21,

41

321

Page 21: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Euclidean Transformation One-to-One Correspondence between the points of such space and the

set of all real-number pair or triples Transforming Only by rotation and translation

wyxtR

wyx

T 1|

|

0'''

)0,0(0

T

y

x

tt

t

Action of the euclidean group on five points

cossinsincos

R

Page 22: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Affine Transformation

wyxtA

wyx

T 1|

|

0'''

projectiveaffineeuclidean

Action of the affine group on five points

Parallel lines are preseved.

R is Replaced by a general non-singular transformation matrix A

Page 23: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

General Linear Transformation

wyx

ttt

ttt

ttt

wyx

33

23

13

32

22

12

31

21

11

'''

It preserves the collinearity of points.

For general non-singular linear transformations T,

We get general linear or projective group of transformations.

Action of the projective group on five points

Page 24: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Coordinate Reference Frames

Coordinate Reference FramesCartesian coordinate system

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

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

– Polar, Spherical, Cylindrical 좌표계등

Page 25: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

2 D Coordinate System

Two-dimensional Cartesian Reference Frames

a) b)

y

xy

x

Page 26: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Polar Coordinates 가장 많이 쓰이는 non-Cartesian System

Elliptical coordinates, hyperbolic, parabolic plane coordinates 등 원 이외에 symmetry 를 가진 다른 2 차 곡선들로도 좌표계 표현 가능 .

sin,cos ryrx

xyyxr 122 tan,

rs

r

Page 27: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Why Polar Coordinates?

x x

y y

dxdx

dd

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

예 ) 원의 표현222 ryx

sin,cos

ryrx

Page 28: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

3D Cartesian Frames

Three Dimensional Point

Page 29: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

3D Cartesian Frames

오른손 좌표계 - 대부분의 Graphics Package 에서 표준

왼손 좌표계

- 관찰자로부터 얼마만큼 떨어져 있는지

나타내기에 편리함

- Video Monitor 의 좌표계

Page 30: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

3D NonCartesian System

Cylindrical coordinates

z

P(,,z)

x axis

y axis

z axis

P(r,, )

x axis

y axis

z axis

r

Spherical coordinates

cosx siny

zz

sincosrx sinsinry

cosrz

Page 31: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Points

가장 기본적인 Output Primitive

0 차원으로 크기와 길이 측정 불가순서쌍 (x,y) 나 vector 형식으로 표기Raster Scan display 의 한 Pixel 차지2D or 3D

Page 32: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Lines

Defined as a list of points(PolyLine)

RasterizationStairstep effect(jaggies)

Page 33: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Line Drawing Algorithm Accomplished by calculating intermediate positions alon

g the line path between two specified endpoint positions

12 xy Bresenham’s Line Algorithm

Page 34: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Why “y=mx” is not good for Graphics Applications

Defects in Nonparametric representation Explicit function 의 경우

1. Can only represent infinite lines, not finite line segments 2. Cannot represent vertical lines(m=) 3. Can only 2D lines, not 3D

Implicit function 의 경우

Redundant representation

Ex) 원호의 표현 :

bmxy

0),( yxf

122 yx x

y

Page 35: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Parametric Line Equation

P1

P2

y = Y1 + t * ( Y2 -Y1 )

x = X1 + t * ( X2 - X1 )

z = Z1 + t * ( Z2 - Z1 )

0.0 t 1.0

p = P1 + t * ( P2 - P1 )p

Page 36: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Parametric Line Equation

P1

P2

x = ( 1 - t ) * X1 + t * X2

0.0 t 1.0

Can Also be thought of as a blending function...

y = ( 1 - t ) * Y1 + t * Y2

z = ( 1 - t ) * Z1 + t * Z2

Page 37: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Linear Blending

q = Q1 + t * ( Q2 - Q1 )

You can linearly blend any two quantities with :

q = ( 1 - t ) * Q1 + t * Q2

Or, if you’d prefer :

Color, Shape, Location, Angle, Scale factors,….

Page 38: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Matrices Definition

A rectangular array of quantities

Scalar multiplication and Matrix Addition

mnmm

n

n

aaa

aaaaaa

A

...:::

...

...

21

22221

11211

2221

1211

2221

1211 ,bbbb

Baaaa

A

22222121

12121111

babababa

BA

2221

1211

kakakaka

kA

Page 39: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Matrix Multiplication Definition

PropertiesNot Commutative

AssotiativeDistributive

Scalar multiplication

× = (i,j)

j-th columni-th row

m l

nnm

l

n

kkjikij bac

1

ABC

BAAB

)()( BCACAB

BCABCBA )(

)()()( ABkkBABkA

Page 40: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Translation

y

x

TT

Tyx

Pyx

P ,''

',

x

y

x

y

(b)

(a)

P

P’

11001

''

yx

TT

yx

y

x

y

x

Ty'y,Tx'x

Page 41: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Scaling x’ = x · Sx , y’ = y · Sy

yx

SS

yx

y

x

00

''

x’ x

P2

(xf, yf) : fixed pointx

y (xf,yf) P1

P3

x’ = xf + (x-xf) sx , y’ = yf + ( y- yf) sy

P)y,x(T)s,s(S)y,x(T'P ffyxff

11001001

1000000

1001001

1yx

TT

SS

TT

'y'x

y

x

y

x

y

x

Page 42: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Rotation

P’ = R P

x = r cos , y = r sin

x’ = r cos ( + ) = r cos cos - r sin sin y’ = r sin ( + ) = r cos sin + r sin cos

x’= x cos - y sin , y’ = x sin + y cos

cossinsincos

R

죄표중심을 회전점으로각 만큼 회전

(x,y)r

(x’,y’)

r

Page 43: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Homogeneous Coordinates

PTP '

In basic Transformations,

PSP 'PRP '

( Addition )

( Multiplication )

( Multiplication ) Only Translation istreated differently

We hope to combine the multiplicative and translational terms for two-dimensional geometric transformations into a single matrix representation for enabling the composite transformations such as,

PTSRTP )('

Page 44: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Extend the matrix

11001001

1''

yx

tt

yx

y

x

11000cossin0sincos

1''

yx

yx

11000000

1''

yx

ss

yx

y

x

We can solve this problem by extending 2 by2 matrix into 3 by 3 matrix

P2

(xf, yf) : fixed pointx

y (xf,yf) P1

P3

11001001

1000000

1001001

1yx

TT

SS

TT

'y'x

y

x

y

x

y

x

Translation Rotation Scaling

Ex)

Page 45: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Homogeneous Space

y

x

z =3

z =2

z =1

P(3x1,3y1,3)

P(2x1,2y1,2)P(x1,y1,1)

P(hx1,hy1,h)= P(X,Y, h)

3D Representarion of homogeneous space

Any two dimensional point can be represented by one of the points along the ray in 3D space

Page 46: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Point at Infinity The points with h=0 are called points at infinity,and this will not appear very often.

Ex) [ X Y h ] = [ 4 3 1]

h x* y* X Y1 4 3 4 31/2 8 6 4 31/3 12 9 4 3… … … … …

1/100 400 300 4 3

Page 47: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Point at Infinity(Cont’d)

01

yxyx

Ex) The intersection point of two Parallel lines

00011111

1

yx

011011110100

100101011011

1001

1

yx

The resulting homogeneous coordinates [1 -1 0] represent the ‘pointof intersection’ for the two parallel lines, i.e. a point at infinity.

Page 48: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Point at Infinity(Cont’d)

Two Lines are intersect each otherif they are not parallel

Non-Homogeneous treatment !!

A

B

Page 49: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Determinant of Matrix For n 2, the Determinant of nn matrix A is,

and for a 2 by 2 matrix,

Ex)

※ if A is a triangular matrix, det A is the product of the entries on the main diagonal of A

n

jjkjk

kj AaA1

det)1(det

211222112221

1211 aaaaaaaa

2042

det00012

det50214

det1det A

2)04(0)00(5)20(1

020142

051A

Page 50: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Properties of Determinants Row Operations

Let A,B be a square matrix1) A 의 한 행의 실수배가 다른 row 에 더해져 B 를 만들었다면 , detB = detA2) A 의 두 행이 교환되어 B 를 생성했다면 , detB = -detA3) A 의 한 행이 k 배된 것이 B 라면 , detB = kdetA

Ex)

Column Operations

AAT detdet ))(det(det)det( BAAB

071982

241A

15))5(31(500

230241

detdet

A

071500

241

230500

241

500230241

Page 51: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Solving Linear Equations Linear Equation

where, ajk and bj are known

Using Matrix Equation

11212111 ... bxaxaxa nn

22222121 ... bxaxaxa nn

nnnnnn bxaxaxa ...2211

...

BAX 1BAX

※Coefficient Matrix A 의 역행렬이 존재할 때만 성립

Page 52: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Inverse Matrix

If ad-bc = 0, then A is not invertible.

IAAIAA 11

• Definition

• 2 2 matrix 의 경우

• PropertiesTT )A()A(AB)AB(A)A( 1111111

acbd

bcadA 11

dcba

A

Page 53: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Inverse Matrix

[ I A-1] 형태의 row reduction 이 존재하지 않으면 , A is not invertible.

• Algorithm for Finding A-1

834301210

A

1AI~IA : Row reduction

Ex)

140001010

430210301

100001010

834210301

100010001

834301210

~~IA

21223142

23729

100010001

21223001010

100210301

143001010

200210301

//

//~

//~~

21223142

237291

//

//A

Page 54: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Gaussian Elimination System 에서 한 행의 실수배를 다른 행에서 빼어 연립방정식의 차수를 줄여나가다 ,

한 변수의 해가 구해지면 , 역으로 대입해 나머지 변수값을 구한다 .

• Elementary Row Operation 1. Multiply any row of the augmented matrix by a nonzero constant 2. Add a multiple of one row to a multiple of any other row 3. Interchange the order of any two rows

22211321223

321

321

321

xxxxxxxxx

187421771223

32

32

321

xxxxxxx

422121771223

3

32

321

xxxxxx

312 123 x,x,x

Page 55: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Using Row Operation

21112

122321213

3

2

1

xxx

21112

122321213

|||

b|A

13

12

2313

21112

122321213

R)(RR)(R

23 47182112

740770213

RR

422112

2100770213

4221

168

2100021002163

4221

189

210002100063

213213

213

100010001

321

x,x,x,x,

22211321223

321

321

321

xxxxxxxxx

Page 56: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Consistency of Linear System

1. Unknown variable 의 수에 비해 equation 의 수가 적을 때 No Unique solution (Infinite set of solution)

2. Unknown variable 의 수에 비해 equation 의 수가 많을 때 1) Consistent 한 경우

: 구한 해가 남은 방정식에 대해서도 성립 (redundant)

2) Inconsistent 한 경우

(infinity)

(no solution)

11321223

321

321

xxxxxx

6223 yx,yx

7223 yx,yx

Page 57: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Singular Matrix

• nn system 이 unique solution 을 갖지 않을 때 , 그 system의 coefficient matrix 를 singular 하다고 한다 .

• 일반적으로 coefficient matrix 를 triangulization 했을 때 ,diagonal 에 0 이 있으면 singular 하다 .

~

21114171425321

10003780

5321( No solution,Inconsistent )

( Infinity,redundant )

00003780

5321

Page 58: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Cramer’s Rule

For invertible nn matrix A and b, let Ai(b) be the matrix obtained from A by replacing column i by the vector b,x of Ax=b is,

niAbAx i

i ,...,2,1,det

)(det

],...,,...,[)( 1 ni ababA

column i

Ex)845

623

21

21

xxxx

8563

)(,4826

)(,4523

21 bAbAA

detA=2 272

3024det

)(det,202

1624det

)(det 22

11

AbAx

AbAx

Page 59: Mathmatics for Computer Graphics A r. Mathematics for Computer Graphics Contents  Spaces  Vectors and Linear combination  Affine Combination  Coordinate-reference

Mathematics for Computer Graphics

Iterative Method

,...

11

131321211 a

xaxaxabx nn ......,...

12

121211122 a

xaxaxabx nn

- Gaussian Elimination 의 roundoff error 를 해결하기 위함- 처음에는 임의의 기대값을 해로 준 다음 error 가 최소가 될 때까지 다음 식에 반복 대입

4271292

88

321

321

321

xxxxxx

xxx

213

312

321

111022203331286014305710125012501

x.x..xx.x..xx.x.x

First Second Third Fourth Fifth Sixth Seventh Eighthx1

x 2

x 3

0 1.000 1.095 0.995 0.993 1.002 1.001 1.000 0 0.571 1.095 1.026 0.990 0.998 1.001 1.000 0 1.333 1.048 0.969 1.000 1.004 1.001 1.000