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

Preview:

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

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)

CS580 Computer Graphics

22D TransformationsD Transformations

Sung Yong ShinDept. of Computer Science

KAIST

Daroko blog

Daroko blog

Outline

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

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

2. Basic Transformations

translation

scaling

rotation

(absolute) transformation

relative transformation

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

(a)

(b)

Non-uniform scaling

sincossinsincoscos

)cos(

yxrr

rx

sincos xyy

Similarly,

( , )Tx y

( , )Tx y

r

r

sincosryrx

Rotation

sincossincosxyyyxx

yx

yx

cossinsincos

( , )TR Rx y

( , )Tx y

( , )Tx y

r

r

( , )Tx y

( , )Tx y

r

r

( , )TR Rx y

: Pivot point

11001

yx

TT

yx

TyyTxx

y

x

y

x

50 100 150

150

100

50

50 100 150

150

100

50

(a)

(b)

Translation

Scaling and Rotation

Translation

How to uniformly treat transformations?

yx

dcba

yx

Observation

11001

yx

fe

yx

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

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

0w

normalized(standard)

No unique homogeneous representation of a Cartesian point !!!

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

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

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

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 !!!

A

B

No orientation !!!BA

However,

Why?

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

Projective Geometry and its Application to Computer Graphics, 1986.

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

Now, uniform treatment !!! Rotation

Scaling

Translation

11000cossin0sincos

'''

yx

wyx

11000000

'''

yx

SS

wyx

y

x

11001001

'''

yx

TT

wyx

y

x

]][]...[[][

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

12

12

TTTT

PTPTTTP

n

n

composite transformation matrix

Homework

4. Composite Transformations

( , )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

( , )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

x

y

Sy

Sx

[Rt]-1[Sc][Rt]

Why if Sx = Sy ?

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

FinalPosition

FinalPosition

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

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

12

3

1’

2’ 3’

Originalposition

Reflectedposition

100001010

1

2

3

1’2’

3’

Originalposition

Reflectedposition

100010001

x

x

y yy = x

45°

[Rt] [Rfx]

45°

[Rt]-1

Reflection about y = x

100001010

1 2

3

1’

2’3’

Originalposition

Reflectedposition

x

yy = -x

(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

(a) (b)

Raster method for transformation

Recommended