35
Daroko blog-where IT leaners apply their Skills Do Not just learn computer graphics an close your computer browser tab and go away.. APPLY them in real business, Visit Daroko blog for real IT skills applications,androind, Computer graphics,Networking,Programming,IT jobs Types, IT news and applications,blogging,Builing a website, IT companies and how you can form yours, Technology news and very many More IT related subject. -simply Google: Daroko blog(www.professionalbloggertricks.com)

2d/3D transformations in computer graphics(Computer graphics Tutorials)

Embed Size (px)

DESCRIPTION

This is an introduction to 2D and 3 in computer graphics presented by daroko blog. • Daroko blog (www.professionalbloggertricks.com) • Presentation by Daroko blog, to see More tutorials more than this one here, Daroko blog has all tutorials related with IT course, simply visit the site by simply Entering the phrase Daroko blog (www.professionalbloggertricks.com) to search engines such as Google or yahoo!, learn some Blogging, affiliate marketing ,and ways of making Money with the computer graphic Applications(it is useless to learn all these tutorials when you can apply them as a student you know),also learn where you can apply all IT skills in a real Business Environment after learning Graphics another computer relate courses.ly • Be practically real, not just academic reader

Citation preview

Page 1: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

Daroko blog-where IT leaners apply their Skills Do Not just learn computer graphics an close your computer browser

tab and go away.. APPLY them in real business, Visit Daroko blog for real IT skills applications,androind,

Computer graphics,Networking,Programming,IT jobs Types, IT news and applications,blogging,Builing a website, IT companies and how you can form yours, Technology news and very many More IT related subject.

-simply Google: Daroko blog(www.professionalbloggertricks.com)

Page 2: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

CS580 Computer Graphics

22D TransformationsD Transformations

Sung Yong ShinDept. of Computer Science

KAIST

Page 3: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

Daroko blog

Daroko blog

Page 4: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

Outline

1. Preliminary2. Basic 2D Transformations3. Homogeneous Coordinate system4. Composite Transformations5. Reflection and Shearing

Page 5: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

per-vertex operations &primitive assembly rasterization frame buffer

texture assembly

display lists

evaluators

pixel operations

per-fragmentoperations

geometricdata

pixeldata

OpenGL Rendering Pipeline

Window-to-viewportmapping

Page 6: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

2. Basic Transformations

translation

scaling

rotation

(absolute) transformation

relative transformation

Page 7: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

yx

SS

yx

ySyxSx

y

x

y

x

00

x

y

( , )TF Fx y : fixed point

1p

2p

3p

y

x

( , )TF Fx y

Scaling

( , )Tx y

( ', ')Tx y

Page 8: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

(a)

(b)

Non-uniform scaling

Page 9: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

sincossinsincoscos

)cos(

yxrr

rx

sincos xyy

Similarly,

( , )Tx y

( , )Tx y

r

r

sincosryrx

Rotation

Page 10: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

sincossincosxyyyxx

yx

yx

cossinsincos

( , )TR Rx y

( , )Tx y

( , )Tx y

r

r

( , )Tx y

( , )Tx y

r

r

( , )TR Rx y

: Pivot point

Page 11: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

11001

yx

TT

yx

TyyTxx

y

x

y

x

50 100 150

150

100

50

50 100 150

150

100

50

(a)

(b)

Translation

Page 12: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

Scaling and Rotation

Translation

How to uniformly treat transformations?

yx

dcba

yx

Observation

11001

yx

fe

yx

Page 13: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

1

( , , ) ( , , 1) ( / , / ) for 0

( , , ) ( / , / ,1) , 0

T T T

T T

P APa b c x

P d e f yg h i

P x y w x w y w x w y w w

x y w x w y w R

3. Homogeneous Coordinate System

w

x

y

( , , )Tx y w

1w( , ,1)Tx w y w

(0,0,1)T

Page 14: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

( , ) ( , ,1) ( , , )T T Tx y x y wx wy w

0w

normalized(standard)

No unique homogeneous representation of a Cartesian point !!!

Page 15: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

What if ? ( , ,0)Tx y0w

lim lim( , ,1)

lim( , ,1 )

( , ,0)

Ttt t

T

t

T

p at bt

a b t

a b

( , ,1)Ttp at bt

w

• Ideal points !!!points at infinity

well, ...

( , ,1)Ta b(0,0,1)T

0 00 01 1 1 0 1

1

t t

a a atp s t b p t b bt

s t

Page 16: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

Projective Space

Points in the Euclidean space + Points at infinityPositions Vectors

Positions and vectors are treated homogeneously!!!

( , , ) , 0Tx y w w ( , , ) , 0Tx y w w

Page 17: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

0 0

0 0

lim lim( , ,1)

lim( , ,1 )

( , ,0)

Ttt t

T

t

p at x bt y

a x t b y t t

a b

0 0( , ,1)Ttp at x bt y 0 0( , ,1)Tx y

( , ,1)Ttp at bt(0,0,1)T ( , ,1)Ta b

lim lim( , ,1) lim( , ,1 ) ( , ,0)T T Ttt t tp at bt a b t a b

Page 18: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

In a Euclidean space two lines intersect each other

If they are not parallel

Non-homogeneous treatment !!!

However, in a projective space,two lines do always intersects.

Homogeneous treatment !!!

Page 19: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

A

B

No orientation !!!BA

However,

Why?

Page 20: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

For detail treatment of this subject, see M. Penna and R. Patterson,

Projective Geometry and its Application to Computer Graphics, 1986.

Page 21: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

rotationscalingtranslationperspective transform

P 'P

T ' where

' [ ', ', '] ,

[ , , ] .

T

T

P TP

P x y w

P x y w

2D Transformation Matrices

ihgfedcba

T

X 'X

Page 22: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

Now, uniform treatment !!! Rotation

Scaling

Translation

11000cossin0sincos

'''

yx

wyx

11000000

'''

yx

SS

wyx

y

x

11001001

'''

yx

TT

wyx

y

x

Page 23: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

]][]...[[][

][]][]...[['

12

12

TTTT

PTPTTTP

n

n

composite transformation matrix

Homework

4. Composite Transformations

Page 24: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

( , )TF Fx y

(a) Original position of object and fixed point

(b) Translate object so that fixed point (xF, yF) is at origin

(c) Scale object with respect to origin

(d) Translate object so that fixed point is returned to position (xF, yF)T

( , )TF Fx y

][ rT

][ cS 1][ rT

Page 25: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

( , )TR Rx y

(a) Original position of object and pivot point

(b) Translation of object so that the pivot point (xR, yR) is at origin

(c) Rotation about origin (d) Translation of object so that the pivot point is returned to position (xR, yR)T

( , )TR Rx y

][ rT

][ tR 1][ rT

Page 26: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

x

y

Sy

Sx

[Rt]-1[Sc][Rt]

Page 27: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

Why if Sx = Sy ?

Page 28: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

x

y

(0, 0)T (1, 0)T

(1, 1)T

(0, 1)T

x

y

(0, 0)T

(3/2, 1/2)T

(2, 2)T

(1/2, 3/2)T

45°Sx = 1Sy = 2

Page 29: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

FinalPosition

FinalPosition

(a) [Rt][Tr] (b) [Tr][Rt]

Page 30: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

Reflection

1

2 3

1’

2’ 3’

Originalposition

Reflectedposition

100010001

1

2

3

1’

2’

3’

Originalposition

Reflectedposition

100010001

x

x

y y

5. Reflection and Shearing

Page 31: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

12

3

1’

2’ 3’

Originalposition

Reflectedposition

100001010

1

2

3

1’2’

3’

Originalposition

Reflectedposition

100010001

x

x

y yy = x

Page 32: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

45°

[Rt] [Rfx]

45°

[Rt]-1

Reflection about y = x

Page 33: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

100001010

1 2

3

1’

2’3’

Originalposition

Reflectedposition

x

yy = -x

Page 34: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

(a) (b) (c)

(0, 0) (0, 0) (0, 0)(1, 0)

(1, 1)(0, 1)

(1, 0)

(3, 1)(2, 1)(0, 1)

(1, 2)

(1, 3)

x

y

x

y

x

y

10001001 xSH

10001001

ySH

Shearing

Page 35: 2d/3D transformations in computer graphics(Computer graphics Tutorials)

(a) (b)

Raster method for transformation