Breaking

गुरुवार, 16 अप्रैल 2020

BCA 4th Sem Notes- 2D Transformation

  • UNIT-I 
~The Advantages of Interactive Graphics
~Representative Uses of Computer Graphics 
~Classification of Application Development of Hardware and software for computer Graphics
~Overview, Scan:
~Converting Lines
~Scan Converting Circles
~Scan Converting Ellipses






  • UNIT-II 
  • ~Hardcopy Technologies
    ~Display Technologies
    ~Raster-Scan Display System
    ~Video Controller
    ~Random-Scan Display processor
    ~Input Devices for Operator Interaction
    ~Image Scanners
    ~Working exposure on graphics tools like Dream Weaver, 3D Effects etc
    ~Clipping
    ~Southland- Cohen Algorithm
    ~Cyrus-Beck Algorithm
    ~Midpoint Subdivision Algorithm






  • UNIT-III 
  • ~Geometrical Transformation
    ~2D Transformation
    ~Homogeneous Coordinates and Matrix Representation of 2DTransformations 
    ~composition of 2D Transformations
    ~The Window-to-Viewport
    Transformations





  • UNIT-V                           

  • ~Multimedia Definition
    ~CD-ROM and the multimedia highway
    ~Computer Animation
    (Design, types of animation, using different functions)






  • UNIT-VI  

  • ~Uses of Multimedia
    ~Introduction to making multimedia –
    ~The stage of Project
    ~hardware & software requirements to make good multimedia skills
    ~Training opportunities in Multimedia Motivation for Multimedia usage

    2D Transformation


    1.Translation

    Translation is to move, or parallel shift, a figure. We use a simple point as a starting point. This is a simple operation that is easy to formulate mathematically. We want to move the point P1 to a new position P2.
    P1=(x1,y1)=(3,3)
    P2=(x2,y2)=(8,5)
    We see that                  P’ = P + T
    x2=x1+5
    y2=y1+2
    This means that translation is defined by adding an offset in the x and y direction: tx and ty:
    x2=x1+tx
    y2=y1+ty

    We assume that we can move thee figures by moving all the single points. 

    Problem-01:


    Given a circle C with radius 10 and center coordinates (1, 4). Apply the translation with distance 5 towards X axis and 1 towards Y axis. Obtain the new coordinates of C without changing its radius.
     Solution-
    Given-
    • Old center coordinates of C = (Xold, Yold) = (1, 4)
    • Translation vector = (Tx, Ty) = (5, 1)
     Let the new center coordinates of C = (Xnew, Ynew).
     Applying the translation equations, we have-
    • Xnew = Xold + Tx = 1 + 5 = 6
    • Ynew = Yold + Ty = 4 + 1 = 5
     Thus, New center coordinates of C = (6, 5).
    Alternatively,
    In matrix form, the new center coordinates of C after translation may be obtained as-

     Thus, New center coordinates of C = (6, 5).

    Problem-02: 

    Given a square with coordinate points A(0, 3), B(3, 3), C(3, 0), D(0, 0). Apply the translation with distance 1 towards X axis and 1 towards Y axis. Obtain the new coordinates of the square.
     Solution-Given-

    • Old coordinates of the square = A (0, 3), B(3, 3), C(3, 0), D(0, 0)
    • Translation vector = (Tx, Ty) = (1, 1)
    For Coordinates A(0, 3)

    Let the new coordinates of corner A = (Xnew, Ynew).
    Applying the translation equations, we have-
    • Xnew = Xold + Tx = 0 + 1 = 1
    • Ynew = Yold + Ty = 3 + 1 = 4 
    Thus, New coordinates of corner A = (1, 4). 

    For Coordinates B(3, 3) 

    Let the new coordinates of corner B = (Xnew, Ynew). 
    Applying the translation equations, we have-
    • Xnew = Xold + Tx = 3 + 1 = 4
    • Ynew = Yold + Ty = 3 + 1 = 4 
    Thus, New coordinates of corner B = (4, 4). 

    For Coordinates C(3, 0)

    Let the new coordinates of corner C = (Xnew, Ynew). 
    Applying the translation equations, we have-
    • Xnew = Xold + Tx = 3 + 1 = 4
    • Ynew = Yold + Ty = 0 + 1 = 1 
    Thus, New coordinates of corner C = (4, 1). 

    For Coordinates D(0, 0) 

    Let the new coordinates of corner D = (Xnew, Ynew). 
    Applying the translation equations, we have-
    • Xnew = Xold + Tx = 0 + 1 = 1
    • Ynew = Yold + Ty = 0 + 1 = 1 
    Thus, New coordinates of corner D = (1, 1).
    Thus, New coordinates of the square = A (1, 4), B(4, 4), C(4, 1), D(1, 1). 
    Example– Given a Point with coordinates (2, 4). Apply the translation with distance 4 towards x-axis and 2 towards the y-axis. Find the new coordinates without changing the radius?
    Solution: P = (x0, y0) = (2,4)
    Shift Vector = (TxTy) = (4, 2)
    Let us assume the new coordinates of P = (x1, y1)
    Now we are going to add translation vector and given coordinates, then
    x1 = x0 + Tx = (2 + 4) = 6
    y1 = y0 + Ty = (4 + 2) = 6
    Thus, the new coordinates = (6,6)
    2d translation

    2.Rotation

    Rotation: A rotation is a transformation that turns every point of a figure through a specified angle and direction about a fixed point.
    The fixed point is called the center of rotation.
    A rotation is an isometry, which means the image and preimage are congruent.
    To describe a rotation you need:
    • direction(clockwise or counterclockwise)
    • degree
    • center point of rotation (this is where compass point goes)

    Common Rotations (about the origin):
    180° (x,y) (-x,-y)
    90° clockwise (x,y)(y,-x)

    90° Counterclockwise(𝑥, 𝑦) → (−𝑦, 𝑥)


    Using standard trigonometric the original coordinate of point P XY can be represented as −
    X=rcosϕ......(1)
    Y=rsinϕ......(2)
    The same way we can represent the point P’   X' &Y'
                                                  x=rcos(ϕ+θ)=rcosϕcosθrsinϕsinθ.......(3)
    y=rsin(ϕ+θ)=rcosϕsinθ+rsinϕcosθ.......(4)
    Substituting equation 1& 2 in 3&4 respectively, we will get
    x=xcosθysinθ
    y=xsinθ+ycosθ
    Representing the above equation in matrix form,

    [XY]=[XY][cosθsinθsinθcosθ]OR

    P’ = P . R
    Where R is the rotation matrix
    R=[cosθsinθsinθcosθ]

    The rotation angle can be positive and negative.
    For a positive rotation angle, we can use the above rotation matrix. However, for negative angle rotation, the matrix will change as shown below −
    R=[cos(θ)sin(θ)sin(θ)cos(θ)]





    3. Scaling

    The size of the object can be changed by using scaling transformation. The scaling process either expands or compresses the dimensions of the object. By multiplying the original coordinates of the object with the scaling factor, scaling can be achieved.

    It is assumed that the original coordinates are (X, Y), the scaling factors are (SX, SY), and the produced coordinates are (X’, Y’). This can be mathematically represented as shown below −
    X' = X . SXandY' = Y . SY
    The scaling factor SX, SY scales the object in X and Y direction respectively. The above equations can also be represented in matrix form as below −

    Where S is the scaling matrix. 



    4. Reflection:-It is a transformation that produces a mirror image of an object. The mirror image can be either about the x-axis or the y-axis. The object is rotated by180°

    Types of Reflection:
    1. Reflection about the x-axis
    1. Reflection about the y-axis
    1. Reflection about an axis perpendicular to the XY plane and passing through the origin
    1. Reflection about line y=x
    The accompanying figures show reflections concerning X and Y tomahawks, and about the starting point separately.
    (I)Reflection about the x-axis                                 (II)     Reflection about the y-axis
                                                    




    (III)Reflection about an axis perpendicular to the XY plane and passing through the origin
                                     

    (IV)     Reflection about the y=x axis








    Example: A triangle ABC is given. The coordinates of A, B, C are given as
                        A (3 4)
                        B (6 4)
                        C (4 8)
    Find reflected position of triangle i.e., to the x-axis.

                             

    A (3 4)
    B (6 4)

    C (4 8)
    reflection of the x=x and y=-y

    The a' point coordinates after reflection (X,Y)=(3,-4)
    The b' point coordinates after reflection(X,Y) =(6,-4)
    The c' point coordinates after reflection(X,Y) =(4,-8)

    a (3, 4) becomes a1 (3, -4)
    b (6, 4) becomes b1 (6, -4)
    c (4, 8) becomes c1 (4, -8)


    5.Shear:-The shape of the object is slanted by Shear transformation. There are two types of shear transformations X-Shear and Y-Shear. By these two methods, X coordinates values and Y coordinate values are shifted. Shearing is also known as Skewing.

    X-Shear

    The X-Shear preserves the Y coordinate and changes are made to X coordinates, which causes the vertical lines to tilt right or left as shown in the below figure.
    Shearing


    Y-Shear

    The Y-Shear preserves the X coordinates and changes the Y coordinates which causes the horizontal lines to transform into lines which slopes up or down as shown in the following figure.



    Shearing in X-Y directions: Here layers will be slided in both x as well as y-direction. The sliding will be in horizontal as well as vertical direction. The shape of the object will be distorted. The matrix of shear in both directions is given by:





    Example 

    Given a triangle with points (1, 1), (0, 0) and (1, 0). Apply shear parameter 2 on X axis and 2 on Y axis and find out the new coordinates of the object.
    Solution-
    Given-
    • Old corner coordinates of the triangle = A (1, 1), B(0, 0), C(1, 0)
    • Shearing parameter towards X direction (Shx) = 2
    • Shearing parameter towards Y direction (Shy) = 2
    Shearing in X Axis-
    For Coordinates A(1, 1)

    Let the new coordinates of corner A after shearing = (Xnew, Ynew).

    Applying the shearing equations, we have-
    • Xnew = Xold + Shx x Yold = 1 + 2 x 1 = 3
    • Ynew = Yold = 1

    Thus, New coordinates of corner A after shearing = (3, 1).

    For Coordinates B(0, 0)


    Let the new coordinates of corner B after shearing = (Xnew, Ynew).

    Applying the shearing equations, we have-
    • Xnew = Xold + Shx x Yold = 0 + 2 x 0 = 0
    • Ynew = Yold = 0

    Thus, New coordinates of corner B after shearing = (0, 0).

    For Coordinates C(1, 0)


    Let the new coordinates of corner C after shearing = (Xnew, Ynew).

    Applying the shearing equations, we have-
    • Xnew = Xold + Shx x Yold = 1 + 2 x 0 = 1
    • Ynew = Yold = 0

    Thus, New coordinates of corner C after shearing = (1, 0).
    Thus, New coordinates of the triangle after shearing in X axis = A (3, 1), B(0, 0), C(1, 0).

    Shearing in Y Axis-


    For Coordinates A(1, 1)


    Let the new coordinates of corner A after shearing = (Xnew, Ynew).

    Applying the shearing equations, we have-
    • Xnew = Xold = 1
    • Ynew = Yold + Shy x Xold = 1 + 2 x 1 = 3

    Thus, New coordinates of corner A after shearing = (1, 3).

    For Coordinates B(0, 0)


    Let the new coordinates of corner B after shearing = (Xnew, Ynew).

    Applying the shearing equations, we have-
    • Xnew = Xold = 0
    • Ynew = Yold + Shy x Xold = 0 + 2 x 0 = 0

    Thus, New coordinates of corner B after shearing = (0, 0).

    For Coordinates C(1, 0)


    Let the new coordinates of corner C after shearing = (Xnew, Ynew).

    Applying the shearing equations, we have-
    • Xnew = Xold = 1
    • Ynew = Yold + Shy x Xold = 0 + 2 x 1 = 2

















    कोई टिप्पणी नहीं:

    एक टिप्पणी भेजें