2 d transformations 2

Upload: speeda5987

Post on 07-Aug-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/20/2019 2 D Transformations 2

    1/24

    Topics to be Covered

    Transformation Geometrical

    Coordinate

    Matrix Representations and Homogenous Coordinates

    Basic Transformations

    Translation

    Rotation

    Scaling

    Reflection

    Shearing

    Composite Transformations

    Copyright @ www.bcanotes.com

  • 8/20/2019 2 D Transformations 2

    2/24

    Transformation

    Simulated spatial manipulation is referred as

    Transformation

    Two types

    Geometric

    Coordinate

  • 8/20/2019 2 D Transformations 2

    3/24

    Translation Displacement of an object in a given distance and direction from its original

    position.

    Rigid body transformation that moves object without deformation Initial Position point P (x, y)

    The new point P’ (x’, y’)

    where

    x’ = x + tx

    y’ = y + tytx and ty is the displacement in x and y respectively.

    The translation pair (tx, ty) is called a translation vector or shift vector

    P(x,y)

    P’(x’,y’)

  • 8/20/2019 2 D Transformations 2

    4/24

    TRANSLATION

    Matrix representation

     y

     x P   

    '

    '

    '  y

     x

     P 

    ty

    tx

  • 8/20/2019 2 D Transformations 2

    5/24

    Rotation

    Rotation is applied to an object by repositioning it

    along a circular path in the xy plane.

    To generate a rotation, we specify

    Rotation angle θ Pivot point ( xr , yr)

    Positive values of θ for counterclockwise rotation

    Negative values of θ for clockwise rotation.

  • 8/20/2019 2 D Transformations 2

    6/24

    2-D Rotation

    (x, y)

    (x’, y’)

    Ф

  • 8/20/2019 2 D Transformations 2

    7/24

    2-D Rotation

    x = r cos (f)

    y = r sin (f)

    x’ = r cos (f + )

    y’ = r sin (f + )

    Trig Identity…

    x’ = r cos(f) cos() – r sin(f) sin()

    y’ = r sin(f) sin() + r cos(f) cos()

    Substitute…

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

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

  • 8/20/2019 2 D Transformations 2

    8/24

    2-D Rotation

     P  R P    '

        

      

    cossin

    sincos R

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

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

    Matrix representation

    Copyright @ www.bcanotes.com

  • 8/20/2019 2 D Transformations 2

    9/24

    Scaling

    Scaling alters the size of an object .

    Operation can be carried out by multiplying each of its

    components by a scalar

    Uniform scaling means this scalar is the same for all

    components:

    2

  • 8/20/2019 2 D Transformations 2

    10/24

    Scaling

    Non-uniform scaling: different scalars per component:

    X 2,

    Y 0.5

  • 8/20/2019 2 D Transformations 2

    11/24

    Scaling

    x’ = x* sx

    y’ = y * sy

    In matrix form:

     y

     x

     sy

     sx

     y

     x

    0

    0

    '

    '

  • 8/20/2019 2 D Transformations 2

    12/24

    Homogenous Coordinate System

    Allows us to express all transformation equations as

    matrix multiplications , providing that we also

    expand the matrix representations for coordinatepositions.

  • 8/20/2019 2 D Transformations 2

    13/24

    Reflection

    A reflection is a transformation that produces a

    mirror image of an object

    Generated relative to an axis of reflection

    1. Reflection along x axis

    2. Reflection along y axis

    3. Reflection relative to an axis perpendicular to the xy plane and

    passing through the coordinate origin

    4. Reflection of an object relative to an axis perpendicular to the xy

    plane and passing through point P

    5. Reflection of an object with respect to the line y=x

  • 8/20/2019 2 D Transformations 2

    14/24

    Reflection About x-Axis

    P1

    P3P2

    P1’

    P2’ P3’

    x

    yOriginalImage

    Reflected Image

  • 8/20/2019 2 D Transformations 2

    15/24

    100

    010

    001

     M 

    Reflection about x-axis

    Reflection About x-Axis

    Copyright @ www.bcanotes.com

  • 8/20/2019 2 D Transformations 2

    16/24

    Reflection About y-axis

    Original

    Image

    x

    y

    Reflected

    Image

  • 8/20/2019 2 D Transformations 2

    17/24

    100

    010

    001

     M 

    Reflection about y-axis

    Reflection About y-axis

    Copyright @ www.bcanotes.com

  • 8/20/2019 2 D Transformations 2

    18/24

    Reflection relative to an axis perpendicular to the xy plane and passing through the

    coordinate origin

    x

    y

    ReflectedImage

    OriginalImage

  • 8/20/2019 2 D Transformations 2

    19/24

    100

    010

    001

     M 

    Reflection about the origin point

    Reflection relative to an axis perpendicular to the xy plane and passing through the

    coordinate origin

    Copyright @ www.bcanotes.com

  • 8/20/2019 2 D Transformations 2

    20/24

    Reflection of an object with respect to the line y=x

    x

    y

    Reflected

    Image

    Original

    Image

  • 8/20/2019 2 D Transformations 2

    21/24

    100

    001

    010

     M 

    Reflection about with respect to line y=x

    Reflection of an object with respect to the line y=x

    Copyright @ www.bcanotes.com

  • 8/20/2019 2 D Transformations 2

    22/24

    Shearing

    A transformation that distorts the shape of an

    object such that the transformed object appears as

    if the object were composed of internal layers that

    had been caused to slide over each other.

  • 8/20/2019 2 D Transformations 2

    23/24

    Shearing

    Shear relative to the x-axis   • Shear relative to the y-axis

    100

    010

    01   y

     sh

    100

    01001   x sh

  • 8/20/2019 2 D Transformations 2

    24/24

    Composite Transformations

    For a sequence of transformations , composite

    transformation matrix could be setup by the matrix

    product of the individual transformations

    Also referred as Concatenation or Composition ofMatrices