coordinate reference frames ♦vector space vectors have magnitude and direction vectors have no...

20
Coordinate Reference Frames Vector Space Vectors have magnitude and direction Vectors have no posotion Affine Space Vector Space + Points (location) Possible Geometric Transform P Truncated plane (No Origin) : Vector Space P 기기기 기 기기기 기기 : Affine Space

Upload: jared-dalton

Post on 21-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Coordinate Reference Frames

♦Vector SpaceVectors have magnitude and direction

Vectors have no posotion

♦Affine SpaceVector Space + Points (location)

Possible Geometric Transform

P

Truncated plane (No Origin): Vector Space

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

Page 2: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Coordinate Reference Frames

♦Affine Space(2)Represent Vector : W

W = a1v1 + a2v2 + a3v3

Represent Point : PP = P0 + b1v1 + b2v2 + b3v3

벡터와 점의 구분을 위해서 1X4 행렬의 사용

e3

e1

e2 e3

e1e2

Basis vectors located at the origin

Page 3: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Points & Vector

♦ Points- 좌표계에서의 한점을 차지 , 위치표시

♦Vector (2D)- 두 position 간의 경로차- Magnitude 와 Direction 으로도 표기

VP2

P1

x1 x2

y1

y222yx VVV

x

y

V

V1tan

),(),( 121212 yx VVyyxxPPV

Page 4: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Vector

♦Vector (3D)

♦ 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 5: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Between two Vector

♦Dot Product– Inner Product 라고도 함– 두 벡터의 사잇각

– V1 • V1 = 0 두 벡터가 직각임을 알수가 있다

|V2|cos

V2

V1

0,cos|||| 2121 VVVV

zzyyxx VVVVVVVV 21212121

Commutative

Distributive1221 VVVV

3121321 )( VVVVVVV

Page 6: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Between two Vector

♦Cross Product– 두 벡터와 직교하는 또 다른 벡터를 얻을 수 있다– 3D Model shading Relation– 연산의 순서 중요

0,sin|||| 2121 VVuVV

V1

V2

V1 V2

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

zyx

zyx

zyx

VVV

VVV

uuu

VV

222

11121 Properties

AntiCommutative

Not Assotiative

Distributive

)( 1221 VVVV

321321 )()( VVVVVV

)()()( 3121321 VVVVVVV

Page 7: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Geometric Transformations

♦Geometric Transform 기존 물체 속성의 변경Translate, Rotate, Scale

♦PurposeView 의 조절물체 (Model) 의 조작 및 조정

Page 8: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Position Standard

♦World Coordinates(Global Coordinate)– Only One

♦Modeling Coordinates(Local Coordinate)– Each Object

Page 9: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Translate

♦Translate

y

x

Ty'y

,Tx'x

110

01

'

'y

x

T

T

y

x

y

x

11000

100

010

001

1

'

'

'

z

y

x

t

t

t

z

y

x

z

y

x

zyx tzztyytxx ',',' zyx tzztyytxx ',','

Page 10: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Rotate

♦Rotate(1)– Originx = 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

Z axis roteate X axis rotate Y axis

rotate

(x,y)

r

(x’,y’)

r

11000

0100

00cossin

00sincos

1

'

'

'

z

y

x

z

y

x

11000

0cossin0

0sincos0

0001

1

'

'

'

z

y

x

z

y

x

11000

0cos0sin

0010

0sin0cos

1

'

'

'

z

y

x

z

y

x

Page 11: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Rotate

♦Rotate(2)– Arbitrary Point

• Translate Fixed Point• General Rotate• Translate Fixde Point• P’ = T^RTP

Page 12: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Rotate

♦Rotate(3)– Arbitrary Axis

• Translation : Translate Arbitrary Axis

1000

100

010

001

1

1

1

z

y

x

TTR

(x2,y2,z2)

(x1,y1,z1)

x

z

y

Page 13: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Rotate

• Establish [ TR ]x x axis

1000

0//0

0//0

0001

1000

0cossin0

0sincos0

0001

dcdb

dbdcT α

xR

(a,b,c)(0,b,c)

Projected Point

Rotated Point

d

c

cb

c

d

b

cb

b

22

22

cos

sin

x

y

z

Page 14: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Rotate

• Rotate about y axis by

(a,b,c)

(a,0,d)

l

d

22

222222

cos,sin

cbd

dacbal

l

d

l

a

1000

0/0/

0010

0/0/

1000

0cos0sin

0010

0sin0cos

ldla

lald

T yR

x

y

Projected Point

zRotated

Point

Page 15: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Rotate

• Rotate about z axis by the desired angle

l

1000

0100

00cossin

00sincos

zRT

y

x

z

Page 16: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Rotate

• Apply the reverse transformation to place the axis back in its initial position

][][][][][][][][ 1TRxRyRzRyRxRTRARBR TTTTTTTT

x

l

l

z

1000

0cos0sin

0010

0sin0cos

1000

0cossin0

0sincos0

0001

1000

100

010

001

1

1

1

1

z

y

x

TTT yRxRTR

Page 17: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Scale

♦Scale– Uniform Scaling

• X’ = X * Sx, Y’ = Y * Sy Z’ = Z * Sz

11000

000

000

000

1

'

'

'

z

y

x

s

s

s

z

y

x

z

y

x

xz

y

Page 18: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Scale

– Fixed Point

11000

100

010

001

1000

000

000

000

1000

100

010

001

1

'

'

'

),,(),,(),,(z

y

x

z

y

x

s

s

s

z

y

x

z

y

x

zyxTsssSzyxTf

f

f

z

y

x

f

f

f

fffzyxfff

x x x xzzzz

y y y y

Original position Translate Scaling Inverse Translate

Page 19: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

Transformations - Shear

♦Shear

X

X

Y(x’,y’)

A

Z

Y

(x,y)

x’ = x + y cotA,y’ = y,z’ = z

Page 20: Coordinate Reference Frames ♦Vector Space Vectors have magnitude and direction Vectors have no posotion ♦Affine Space Vector Space + Points (location)

OpenGL Function

◊glPushMatrix – glTranslatef, glRotatef 등의 기록

◊glPopMatrix – 저장된 glTranslatef, glRotatef 등의 기록 제거

◊glLoadMatrix – 특정 Matrix 의 호출

◊glTranslatef – Translate Matrix 기록

◊glRotatef – Rotate Matrix 기록

◊glScaled, glScalef – Scale Matrix 기록

◊glBegin – delimit the vertices of a primitive or a group of like primitives

◊glVertex3fv