Top Banner

of 84

Lecture11!11!16827 2D Transformations

Feb 12, 2018

Download

Documents

Sheeza Khan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/23/2019 Lecture11!11!16827 2D Transformations

    1/84

    Chapter 5

    2-D Transformations

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    2/84

    October 13, 2015 Computer Graphics 2

    Contents

    1. Homogeneous coordinates

    2. Matrices

    3. Transformations

    4. Geometric Transformations

    5. Inverse Transformations

    6. Coordinate Transformations

    7. Composite transformations

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    3/84

    October 13, 2015 Computer Graphics 3

    Homogeneous Coordinates

    There are three t!pes of co"ordinate s!stems1. Cartesian Co-ordinate System

    # Left Handed Cartesian Co-ordinate System$ C%oc&'ise(

    # Right Handed Cartesian Co-ordinate System $ )nti C%oc&'ise(

    2. Polar Co-ordinate System

    3. Homogeneous Co-ordinate System

    *e can a%'a!s change from one co"ordinate s!stem to

    another.

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    4/84

    October 13, 2015 Computer Graphics 4

    Homogeneous Coordinates

    # ) point (x, ycan +e re"'ritten in homogeneouscoordinatesas (xh, yh, h

    # The homogeneous parameterhis a non",ero va%ue suchthat-

    # *e can then 'rite an! point (x, yas (hx, hy, h

    # *e can convenient%! choose h ! 1so that(x, y+ecomes (x, y, 1

    hxx h=

    hyy h=

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    5/84

    October 13, 2015 Computer Graphics 5

    Homogeneous Coordinates

    Advantages:. Mathematicians use homogeneous coordinates as the!

    a%%o' sca%ing factors to +e removed from e/uations.

    2. )%% transformations can +e represented as 303 matrices

    ma&ing homogeneit! in representation.

    3. Homogeneous representation a%%o's us to use matri1mu%tip%ication to ca%cu%ate transformations e1treme%!efficient

    4. ntire o+ect transformation reduces to sing%e matri1mu%tip%ication operation.

    5. Com+ined transformation are easier to +ui%t andunderstand.

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    6/84

    October 13, 2015 Computer Graphics 6

    Contents

    . Homogeneous coordinates

    2. Matrices

    3. Transformations

    4. Geometric Transformations

    5. Inverse Transformations

    6. Coordinate Transformations

    7. Composite transformations

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    7/84

    October 13, 2015 Computer Graphics 7

    Matrices

    Definition- ) matrixis an n m arra! of sca%ars arranged

    conceptua%%! in n ro's and m co%umns 'here n and m are

    positive integers. *e use ) and C to denote matrices.

    If n 8 m 'e sa! the matri1 is a square matrix. *e often refer to a matri1 'ith the notation

    A = a!i"#$%" 'here a$i( denotes the sca%ar in the ith ro' and

    the th co%umn

    9ote that the te1t uses the t!pica% mathematica% notation 'here

    the i and are su+scripts. *e:%% use this a%ternative form as it is

    easier to t!pe and it is more fami%iar to computer scientists.

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    8/84

    October 13, 2015 Computer Graphics 8

    Matrices

    &ca'ar-matrix mu'tip'ication:

    ) 8 ;a$i(s e%se'here Theinverse )". does not a%'a!s e1ist. If it does then

    )".) 8 ) )".8 I

    Given a matri1 ) and another matri1 'e can chec& 'hether

    or not is the inverse of ) +! computing ) and ) and

    seeing that ) 8 ) 8 I

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    10/84

    October 13, 2015 Computer Graphics 10

    Matrices

    # ach point ?$1!( in the homogenous matri1 form is

    represented as

    # @eca%% matri1 mu%tip%ication ta&es p%ace-

    3333000

    000

    000

    xxx"iyhxg

    "fyexd

    "#y$xa

    "

    y

    x

    ihg

    fed

    #$a

    ++

    ++

    ++

    =

    3

    x

    y

    x

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    11/84

    October 13, 2015 Computer Graphics 11

    Matrices

    Matri1 mu%tip%ication does 9AT #ommute-

    Matri1 composition 'or&s right-to-left.

    # Compose-

    # Then app%! it to a co%umn matri1 v-

    It first appies Cto v, the! appies B to the resut, the! appies A to the resut of

    that"

    MN NM

    v = Mv

    v = ABC( )v

    v = A

    B

    C

    v( )( )

    M = ABC

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    12/84

    October 13, 2015 Computer Graphics 12

    Contents

    . Homogeneous coordinates

    2. Matrices

    ). Transformations

    4. Geometric Transformations

    5. Inverse Transformations

    6. Coordinate Transformations

    7. Composite transformations

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    13/84

    October 13, 2015 Computer Graphics 13

    Transformations

    # ) transformationis a function that maps a point $or vector(into another point $or vector(.

    # )n affine transformationis a transformation that maps %ines

    to %ines.

    # *h! are affine transformations BniceB

    *e can define a po%!gon using on%! points and the %ine segments

    oining the points.

    To move the po%!gon if 'e use affine transformations 'e on%! must

    map the points defining the po%!gon as the edges 'i%% +e mapped to

    edges

    # *e can mode% man! o+ects 'ith po%!gons"""and shou%d"""

    for the a+ove reason in man! cases.

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    14/84

    October 13, 2015 Computer Graphics 14

    Transformations

    # )n! affine transformation can +e o+tained +! app%!ing inse/uence transformations of the form

    Trans%ate

    Dca%e

    @otate @ef%ection

    # Do to move an o+ect a%% 'e have to do is determine the

    se/uence of transformations 'e 'ant using the 4 t!pes of

    affine transformations a+ove.

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    15/84

    October 13, 2015 Computer Graphics 15

    Transformations

    # *eometric Transformations: In Geometric transformationan o+ect itse%f is moved re%ative to a stationar! coordinates!stem or +ac&ground. The mathematica% statement of thisvie' point is descri+ed +! geometric transformation app%ied

    to each point of the o+ect.

    # +oordinate Transformation: The o+ect is he%d stationar!

    'hi%e coordinate s!stem is moved re%ative to the o+ect.These can easi%! +e descri+ed in terms of the oppositeoperation performed +! Geometric transformation.

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    16/84

    October 13, 2015 Computer Graphics 16

    Transformations

    # *hat does the transformation do

    # *hat matri1 can +e used to transform the origina%

    points to the ne' points

    # @eca%%""" moving an o+ect is the same as changing a

    frame so 'e &no' 'e need a 3 3 matri1

    # It is important to remem+er the form of these

    matrices

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    17/84

    October 13, 2015 Computer Graphics 17

    Contents

    . Homogeneous coordinates

    2. Matrices

    3. Transformations

    ,. *eometric Transformations

    5. Inverse Transformations

    6. Coordinate Transformations

    7. Composite transformations

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    18/84

    October 13, 2015 Computer Graphics 18

    Geometric Transformations

    # In Geometric transformation an o+ect itse%f is moved re%ativeto a stationar! coordinate s!stem or +ac&ground. The

    mathematica% statement of this vie' point is descri+ed +!

    geometric transformation app%ied to each point of the o+ect.

    Earious Geometric Transformations are-

    Trans'ation

    Dca%ing

    @otation

    @ef%ection Dhearing

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    19/84

    Geometric Transformations

    #Trans'ation

    #Dca%ing#@otation

    #@ef%ection

    #Dhearing

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    20/84

    October 13, 2015 Computer Graphics 20

    Geometric Trans%ation

    Is defined as the disp%acement of an! o+ect +! a given

    distance and direction from its origina% position. In simp%e

    'ords it moves an o+ect from one position to another.

    x

    ! x % tx y

    ! y % ty

    9ote- House shifts position re%ative to origin

    y

    x>

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

    E 8 t1I=t!J

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    21/84

    October 13, 2015 Computer Graphics 21

    Geometric Trans%ation 1amp%e

    y

    x>

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

    $ ( $3 (

    $2 3(

    Trans'ation )(/20

    $4 3(

    $5 5(

    $6 3(

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    22/84

    October 13, 2015 Computer Graphics 22

    Geometric Trans%ation

    # To ma&e operations easier 2" points are 'ritten as

    homogenous coordinate co%umn vectors

    # The trans%ation of a point ?(x,y+! (tx, tycan +e 'ritten

    in matri1 form as-

    =

    =

    =

    +==

    ...>>

    .>

    >.

    ($

    y

    x

    Py

    x

    Pty

    tx

    &

    'ty(tx)*hereP&P

    )

    )

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    23/84

    October 13, 2015 Computer Graphics 23

    Geometric Trans%ation

    # @epresenting the point as a homogeneous co%umn vector

    'e perform the ca%cu%ation as-

    tyyytxxx

    #om+aringon

    tyy

    txx

    yx

    tyyx

    txyx

    y

    x

    ty

    tx

    y

    x

    +=+=

    +

    +

    =

    ++++

    ++

    =

    =

    ..0.0>0>

    .00.0>

    .00>0.

    ..>>

    .>

    >.

    .

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    24/84

    Geometric Transformations#Trans%ation

    #&ca'ing#@otation

    #@ef%ection

    #Dhearing

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    25/84

    October 13, 2015 Computer Graphics 25

    Geometric Dca%ing

    Dca%ing is the process of e1panding or compressing the

    dimensions of an o+ect determined +! the sca%ing factor.

    Dca%ar mu%tip%ies a%% coordinates

    x

    ! Sx x y

    ! Sy y AT+H 3T:

    # A+ects gro' and move

    9ote- House shifts position re%ative to origin

    y

    x>

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

    2

    3

    3

    6

    3

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    26/84

    October 13, 2015 Computer Graphics 26

    Geometric Dca%ing

    # The sca%ing of a point ?(x,y+! sca%ing factors Sxand Sy

    a+out origin can +e 'ritten in matri1 form as-

    =

    =

    =

    =

    =

    =

    >>

    >>

    >>

    >>

    >>>>

    ($

    ys

    xs

    y

    x

    s

    s

    y

    x

    thatsu#h

    yx

    Pyx

    Pss

    S

    *herePSP

    y

    x

    y

    x

    y

    x

    sysx

    sysx

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    27/84

    October 13, 2015 Computer Graphics 27

    Geometric Dca%ing 1amp%e

    y

    >

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

    $ ( $3 (

    $2 3(

    $2 2( $6 2(

    $46(

    &ca'e !2" 2$

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    28/84

    Geometric Transformations#Trans%ation

    #Dca%ing

    #4otation

    #@ef%ection

    #Dhearing

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    29/84

    October 13, 2015 Computer Graphics 29

    Geometric @otation

    # The rotation of a point ? $x,y( about origin +! specifiedang%e (/ counter c%oc&'ise( can +e o+tained as

    x8x cos#y sin

    y8x sin=y cos

    # To rotate an o+ect 'e have to rotate a%% coordinates

    6

    =

    y

    x>

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

    x

    $1!(

    $1:!:(

    5et us derive these equations

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    30/84

    October 13, 2015 Computer Graphics 30

    Geometric @otation

    +

    =

    =

    =

    =

    =

    =

    cossin

    sincos

    >>

    >cossin

    >sincos

    >>

    >cossin>sincos

    ($

    yx

    yx

    y

    x

    y

    x

    thatsu#h

    yx

    Pyx

    PR

    *herePRP

    # The rotation of a point ?(x,y+! an ang%e a+out origincan +e 'ritten in matri1 form as-

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    31/84

    October 13, 2015 Computer Graphics 31

    Geometric @otation 1amp%e

    y

    >

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

    $>>( $2>(

    $2(

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    32/84

    Geometric Transformations#Trans%ation

    #Dca%ing

    #@otation

    #4ef'ection

    #Dhearing

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    33/84

    October 13, 2015 Computer Graphics 33

    Geometric @ef%ection

    # Mirror ref%ection is o+tained a+out "a1is

    x8 x

    y8 # y

    # Mirror ref%ection is o+tained a+out "a1isx8 #x

    y8yy

    x>

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

    " "F "7 "6 "5 "4 "3 "2 "">

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    34/84

    October 13, 2015 Computer Graphics 34

    Geometric @ef%ection

    # The ref%ection of a point ?(x,ya+out "a1is can +e 'ritten

    in matri1 form as-

    =

    =

    =

    =

    =

    =

    >>

    >>

    >>

    >>

    >>>>

    ($

    y

    x

    y

    x

    y

    x

    thatsu#h

    yx

    Pyx

    P0

    *hereP0P

    x

    x

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    35/84

    October 13, 2015 Computer Graphics 35

    Geometric @ef%ection

    # The ref%ection of a point ?(x,ya+out "a1is can +e 'ritten

    in matri1 form as-

    =

    =

    =

    =

    =

    =

    >>

    >>

    >>

    >>

    >>>>

    ($

    y

    x

    y

    x

    y

    x

    thatsu#h

    yx

    Pyx

    P0

    *hereP0P

    y

    y

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    36/84

    October 13, 2015 Computer Graphics 36

    Geometric @ef%ection

    # The ref%ection of a point ?(x,ya+out origin can +e 'ritten

    in matri1 form as-

    =

    =

    =

    =

    =

    =

    >>

    >>

    >>

    >>

    >>>>

    ($

    y

    x

    y

    x

    y

    x

    thatsu#h

    yx

    Pyx

    P0

    *hereP0P

    xy

    xy

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    37/84

    Geometric Transformations#Trans%ation

    #Dca%ing

    #@otation

    #@ef%ection

    #&hearing

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    38/84

    October 13, 2015 Computer Graphics 38

    Geometric Dhearing

    # It us defined as ti%ting in a given direction

    # Dhearing a+out !"a1is

    x8 x % ay

    y

    8y % $xy

    x>

    2 3 4 5

    2

    3

    $(

    y

    x>

    2 3 4 5

    2

    3

    a = 2

    = )

    4 $ 34(

    $ 2(

    $ 3(

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    39/84

    October 13, 2015 Computer Graphics 39

    Geometric Dhearing

    # The shearing of a point ?(x,yin genera% can +e 'ritten in

    matri1 form as-

    +

    +

    =

    =

    =

    =

    =

    =

    >>

    >

    >

    >>

    >>

    ($

    6

    6

    $xy

    ayx

    y

    x

    $

    a

    y

    x

    thatsu#h

    yx

    Pyx

    P$a

    Sh

    *herePShP

    $a

    $a

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    40/84

    October 13, 2015 Computer Graphics 40

    Geometric Dhearing

    # If + 8 > +ecomes Dhearing a+out "a1is

    x8 x % ay

    y8y

    y

    x>

    2 3 4 5

    2

    3

    $(

    y

    x>

    2 3 4 5

    2

    3 a = 2

    $ 2($ 3(

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    41/84

    October 13, 2015 Computer Graphics 41

    Geometric Dhearing

    # The shearing of a point ?(x,ya+out "a1is can +e 'ritten

    in matri1 form as-

    +

    =

    =

    =

    =

    =

    =

    >>

    >>

    >

    >>

    >>>

    ($

    >6

    >6

    y

    ayx

    y

    xa

    y

    x

    thatsu#h

    yx

    Pyx

    Pa

    Sh

    *herePShP

    a

    a

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    42/84

    October 13, 2015 Computer Graphics 42

    Geometric Dhearing

    # If a 8 > it +ecomes Dhearing a+out !"a1is

    x8 x

    y8y % $x

    y

    x>

    2 3 4 5

    2

    3

    $(

    y

    x>

    2 3 4 5

    2

    3 = )

    4

    $ 3(

    $ 4(

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    43/84

    October 13, 2015 Computer Graphics 43

    Geometric Dhearing

    # The shearing of a point ?(x,ya+out "a1is can +e 'ritten

    in matri1 form as-

    +=

    =

    =

    =

    =

    =

    >>

    >

    >>

    >>

    >>>

    ($

    6>

    6>

    $xy

    x

    y

    x

    $y

    x

    thatsu#h

    yx

    Pyx

    P$Sh

    *herePShP

    $

    $

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    44/84

    October 13, 2015 Computer Graphics 44

    Contents

    . Homogeneous coordinates

    2. Matrices mu%tip%ications

    3. Transformations

    4. Geometric Transformations

    6. (nverse Transformations

    6. Coordinate Transformations

    7. Composite transformations

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    45/84

    October 13, 2015 Computer Graphics 45

    Inverse Transformations

    # (nverse Trans'ation- isp%acement in direction of #E

    # (nverse &ca'ing- ivision +! Sxand Sy

    ==

    >>

    >

    >

    ty

    tx

    && ))

    ==

    .>>

    >.>

    >>.

    J.6J.

    .

    6 y

    x

    sysxsysx S

    S

    SS

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    46/84

    October 13, 2015 Computer Graphics 46

    Inverse Transformations

    # (nverse 4otation- @otation +! an ang%e of #

    # (nverse 4ef'ection- @ef%ect once again

    ==

    >>

    >>

    >>

    xx 00

    ==

    >>

    >cossin

    >sincos

    RR

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    47/84

    October 13, 2015 Computer Graphics 47

    Contents

    . Homogeneous coordinates

    2. Matrices mu%tip%ications

    3. Transformations

    4. Geometric Transformations

    5. Inverse Transformations

    7. +oordinate Transformations

    7. Composite transformations

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    48/84

    October 13, 2015 Computer Graphics 48

    Coordinate Transformations

    #+oordinate Transformation: The o+ect is he%dstationar! 'hi%e coordinate s!stem is moved re%ative

    to the o+ect. These can easi%! +e descri+ed in terms

    of the opposite operation performed +! Geometric

    transformation.

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    49/84

    October 13, 2015 Computer Graphics 49

    Coordinate Transformations

    # +oordinate Trans'ation- isp%acement of the coordinate

    s!stem origin in direction of #E

    # +oordinate &ca'ing- Dca%ing an o+ect +! Sxand Sy or

    reducing the sca%e of coordinate s!stem.

    == .>>

    .>

    >.

    ty

    tx

    && ))

    ==

    >>

    >>>>

    J6J6 y

    x

    sysxsysx SS

    SS

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    50/84

    October 13, 2015 Computer Graphics 50

    Coordinate Transformations

    # +oordinate 4otation- @otating Coordinate s!stem +! an

    ang%e of #

    # +oordinate 4ef'ection- Dame as Geometric @ef%ection

    $'h!(

    ==

    >>

    >>

    >>

    xx 00

    ==

    >>

    >cossin

    >sincos

    RR

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    51/84

    October 13, 2015 Computer Graphics 51

    Contents

    . Homogeneous coordinates

    2. Matrices mu%tip%ications

    3. Transformations

    4. Geometric Transformations

    5. Inverse Transformations

    6. Coordinate Transformations

    8. +omposite transformations

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    52/84

    October 13, 2015 Computer Graphics 52

    Composite Transformations

    # ) num+er of transformations can +e com+ined into one matri1 to

    ma&e things eas!

    )%%o'ed +! the fact that 'e use homogenous coordinates

    # Matri1 composition 'or&s right-to-left.

    Compose-

    Then app%! it to a point-

    It first app%ies +to v" then app%ies 9 to the resu%t then app%ies A to the resu%t of that.

    M = A

    B

    C

    v = Mv

    v = ABC( )vv = A B Cv( )( )

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    53/84

    October 13, 2015 Computer Graphics 53

    Composite Transformations

    4otation aout Aritrar oint !h";$

    # Imagine rotating an o+ect around a point $h&( other than

    the origin

    Trans%ate point $h&( to origin

    @otate around origin

    Trans%ate +ac& to point

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    54/84

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    55/84

    October 13, 2015 Computer Graphics 55

    Composite TransformationsKet ? is the o+ect point 'hose rotation +! an ang%e a+out the fi1ed point $h&(is to +e found. Then the composite transformation @6$h6&(can +e o+tained +!

    performing fo%%o'ing se/uence of transformations -

    . Trans%ate $h&( to origin and the ne' o+ect point is found as

    ?8 TE$?( 'here E8 # hI # &L

    2. @otate o+ect a+out origin +! ang%e and the ne' o+ect point is

    ?28 @$?(

    3. @etrans%ate $h&( +ac& the fina% o+ect point is

    ?M8 T"E$?2( 8 T"E $?2(

    The composite transformation can be obtained by back substituting

    ?M

    8 T"E$?2

    (8 T"E@$?(

    8 T"E@TE$?( 'here E 8 # hI # &L

    Thus 'e form the matri1 to +e @$h&(8 T"E@TE

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    56/84

    October 13, 2015 Computer Graphics 56

    Composite Transformations

    # The composite rotation transformation matri1 is

    +

    ++

    =

    =

    >>

    cossincossin

    sincossincos

    >>

    >

    >

    >>

    >cossin

    >sincos

    >>

    >

    >

    (6$6

    11h

    h1h

    1

    h

    1

    h

    R 1h

    REMEMBER:#atri$ mutipicatio! is !ot

    commutati%e so or&er matters

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    57/84

    October 13, 2015 Computer Graphics 57

    Composite Transformations

    &ca'ing aout Aritrar oint !h";$

    # Imagine sca%ing an o+ect around a point $h&( other than

    the origin

    Trans%ate point $h&( to origin

    Dca%e around origin

    Trans%ate +ac& to point

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    58/84

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    59/84

    October 13, 2015 Computer Graphics 59

    Composite Transformations

    # The composite sca%ing transformation matri1 is

    +

    +

    =

    =

    >>

    .>

    .>

    >>

    >

    >

    >>

    >>

    >>

    >>

    >

    >

    (6$66

    1sy1sy

    hsxhsx

    1

    h

    sy

    sx

    1

    h

    S 1hsysx

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    60/84

    October 13, 2015 Computer Graphics 60

    1ercises

    x

    y

    >

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

    '2, 3(

    '3, 2('1, 2(

    '2, 1(

    Trans%ate the shape +e%o' +! $7 2(

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    61/84

    October 13, 2015 Computer Graphics 61

    1ercises 2

    x

    y

    >

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

    '2, 3(

    '3, 2('1, 2(

    '2, 1(

    Dca%e the shape +e%o' +! 3 inxand 2 iny

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    62/84

    October 13, 2015 Computer Graphics 62

    1ercises 3@otate the shape +e%o' +! 3>N a+out the origin

    x

    y

    >

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

    '2, 3(

    '3, 2('1, 2(

    '2, 1(

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    63/84

    October 13, 2015 Computer Graphics 63

    1ercise 4

    *rite out the homogeneous matrices for the previous

    three transformations

    OOOOOO

    OOOOOO

    OOOOOO

    OOOOOO

    OOOOOO

    OOOOOO

    OOOOOO

    OOOOOO

    OOOOOO

    )ra!satio! *cai!+ otatio!

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    64/84

    October 13, 2015 Computer Graphics 64

    1ercises 5

    Psing matri1 mu%tip%ication ca%cu%ate the rotation of theshape +e%o' +! 45N a+out its centre $5 3(

    x

    y

    >

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    '5, 4(

    '6, 3('4, 3(

    '5, 2(

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    65/84

    October 13, 2015 Computer Graphics 65

    1ercise 6

    @otate a triang%e )C )$>>( $( C$52( +! 45>

    . )+out origin $>>(

    2. )+out ?$""(

    =

    >>

    >2222

    >2222>

    45R

    =>>

    22222

    2222

    ($45>

    R

    =2>

    5>

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    66/84

    October 13, 2015 Computer Graphics 66

    1ercise 7

    Magnif! a triang%e )C )$>>( $( C$52( t'ice &eeping

    point C$52( as fi1ed.

    =>>

    22>

    5>2

    (25$22S

    =2>2

    535

    5>

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    67/84

    October 13, 2015 Computer Graphics 67

    1ercise F

    Ket ? +e the o+ect point

    'hose ref%ection is to ta&en

    a+out %ine K that ma&es anang%e 'ith =ve "a1isand has intercept as

    $>+(. The composite

    transformation MK can +efound +! app%!ing

    fo%%o'ing transformations

    in se/uence-X-axis

    -.m$/b

    Y-axis

    '0,b(

    '$,(

    '$,(

    Descrie transformation M5

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    68/84

    October 13, 2015 Computer Graphics 68

    1ercise F. Trans%ate $>+( to origin so that %ine passes through origin and

    ? is transformed as

    ?I8 TE$?( 'here E 8 #hI #&L

    2. @otate +! an ang%e of #so that %ine a%igns 'ith =ve "a1is

    ?II8 @"$?I(

    3. 9o' ta&e mirror ref%ection a+out "a1is.

    ?III8 M1$?II(

    4. @e"rotate %ine +ac& +! ang%e of

    ?IE8 @$?III(5. @etrans%ate $>+( +ac&.

    ?8 T"E$?IE(

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    69/84

    October 13, 2015 Computer Graphics 69

    1ercise FThe composite transformation can be obtained by back

    substituting

    ?8 T"E$?IE(

    8 T"E.@$?III(

    8 T"E.@. M1$?II(8 T"E.@. M1 .@"$?I(

    8 T"E.@. M1 .@". TE$?(

    Thus 'e form the matri1 to +e MK8 T"E.@. M1 .@". TE

    'here E 8 #>.I #+.L

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    70/84

    October 13, 2015 Computer Graphics 70

    1ercise F

    +

    =

    =

    =

    =

    >>

    (sin$coscossincossin2

    cossin2cossin2sincos>>

    coscossin

    sinsincos

    >>

    cossin

    >sincos

    >>

    coscossin

    sinsincos

    >>

    >>

    >>

    >>

    cossin

    >sincos

    >>

    >

    >>

    >>

    >cossin

    >sincos

    >>

    >>

    >>

    >>

    >cossin

    >sincos

    >>

    >

    >>

    2222

    22

    $$

    $

    $

    $

    $

    $

    $

    $

    $$0L

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    71/84

    October 13, 2015 Computer Graphics 71

    1ercise F

    ...

    >>

    2

    2

    2

    2

    C($tan6tan

    tan2sin6

    tan

    tan2cos

    >>

    2cos2cos2sin

    2sin2sin2cos

    >>

    (sin$coscossincossin2

    cossin2cossin2sincos

    22

    2

    2

    222

    2

    2

    2

    2

    2

    2222

    22

    0&Cm

    $

    m

    m

    m

    mm

    $m

    m

    m

    m

    m

    *hymand+utting

    $$

    $

    $$

    $

    0L

    ++

    +

    +

    ++

    =

    =+

    =+

    =

    +

    =

    +

    =

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    72/84

    October 13, 2015 Computer Graphics 72

    1ercise

    @ef%ect the diamond shaped po%!gon 'hose vertices are )$">(

    $>"2( C$>( and $>2( a+out

    . Hori,onta% Kine !82

    2.Eertica% Kine 1 8 2

    3. Kine K- !81=2.

    ==

    >>

    4>

    >>

    2y0

    ==

    >>

    >>

    4>

    2x0

    =+=

    >>2>

    2>

    2xy

    0

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    73/84

    October 13, 2015 Computer Graphics 73

    1ercise >

    A+tain ref%ection a+out Kine ! 8 1

    =

    =

    =

    >>

    >>

    >>

    >>

    >>

    >>

    >>

    >cossin

    >sincos

    @erotateanda1isa+outref%ectionta&e45"+!@otate-

    @erotateanda1isa+outref%ectionta&e45+!@otate-

    >>

    >>

    4545

    >

    4545

    >

    yx

    x

    y

    00RHere

    R0R

    0ethod

    R0R

    0ethod

    ==

    >>

    >>

    >>

    xy0

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    74/84

    October 13, 2015 Computer Graphics 74

    1ercise

    ?rove that

    a. T'o successive trans%ations are additive Jcommutative.

    +. T'o successive rotations are additive Jcommutative.

    c. T'o successive Dca%ing are mu%tip%icative Jcommutative.

    d. T'o successive ref%ections are nu%%ified JInverti+%e.

    Is Trans%ation fo%%o'ed +! @otation e/ua% to @otation fo%%o'ed

    +! trans%ation

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    75/84

    October 13, 2015 Computer Graphics 75

    1ercise a. T

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    76/84

    October 13, 2015 Computer Graphics 76

    1ercise A'so"

    e#ommutati)arenstranslatiosu##essi)et*oHen#e

    &&&

    tyty

    txtx

    tyty

    txtx

    tytx

    tytx

    .&&&

    ))))

    ))))

    .

    >>

    :>

    :>

    >>

    :>

    :>

    >>

    :>:>

    .

    >>

    >>

    ::

    ::

    ==

    +

    +

    =

    +

    +

    =

    ==

    +

    +

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    77/84

    October 13, 2015 Computer Graphics 77

    1ercise . T

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    78/84

    October 13, 2015 Computer Graphics 78

    1ercise A'so"

    e#ommutati)ares#alingssu##essi)et*oHen#e

    .SSS

    sysy

    sxsx

    sysy

    sxsx

    sysx

    sysx

    .SSS

    sysxsysxsysysxsx

    sysxsysxsysysxsx

    :::.:.

    :::.:.

    >>

    >:.>

    >>:.

    >>

    >:.>

    >>:.

    >>

    >:>>>:

    .

    >>

    >>>>

    ==

    =

    =

    ==

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    79/84

    October 13, 2015 Computer Graphics 79

    1ercise c. Tcommutative.

    addit)earerotationssu##essi)et*oHen#e

    R

    .RR

    2

    2

    >>

    >(cos$(sin$

    >(sin$(cos$

    >>

    >cossin

    >sincos

    .

    >>

    >cossin

    >sincos

    .+!rotation+!fo%%o'ed+!rotationtheformu%atefirst*e

    andang%e+!descri+edarerotationsKet t'o

    22

    22

    22

    22

    2

    2

    +=

    ++

    ++

    =

    =

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    80/84

    October 13, 2015 Computer Graphics 80

    1ercise A'so"

    e#ommutati)arerotationssu##essi)et*oHen#e

    .RRR

    .RR

    22

    2

    >>

    >(cos$(sin$

    >(sin$(cos$

    >>

    >(cos$(sin$

    >(sin$(cos$

    >>

    >cossin>sincos

    .

    >>

    >cossin>sincos

    22

    22

    22

    22

    22

    22

    ==

    ++

    ++

    =

    ++

    ++

    =

    =

    +

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    81/84

    October 13, 2015 Computer Graphics 81

    1ercise d. T>

    >>

    >>

    >>

    >>

    >>

    .

    >>

    >>

    >>

    a1is"a+outref%ectionconsiderusKet

    =

    =

    =

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    82/84

    * t h

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    83/84

    October 13, 2015 Computer Graphics 83

    *cratch

    x

    y

    >

    2

    2

    3 4 5 6 7 F >

    3

    4

    5

    6

  • 7/23/2019 Lecture11!11!16827 2D Transformations

    84/84