Page 83 - DCAP504_Computer Graphics
P. 83

Computer Graphics



                          When this concept is applied to  the xy-coordinate plane, the x and y is replaced with  x/z and y/z
                          respectively, i.e. a function f(x, y) =0 becomes f(x/z, y/z) =0.
                          Consider a line represented in an equation form, Ax + By + C =0. Replace x and y with x/z and y/z
                          respectively. The equation now becomes,
                          A(x/z) + B(y/z) + C =0
                          Multiply the above equation by z, then it becomes,
                          Ax + By + Cz =0.
                          This is for first order polynomial equation of a line.

                          The second order polynomial equation of a line is given as,
                          Ax  + 2Bxy + Cy  + 2-Dx + 2Ey + F = 0
                            2
                                       2
                          In the above equation replace x and y with x/z and y/z respectively and multiply it with z , then the
                                                                                                     2
                          equation becomes,
                          Ax  + 2Bxy + Cy  + 2-Dxz + 2Eyw + Fz = 0
                                       2
                            2
                                                         2
                          From the above two polynomial equations, it is clear that the degree of all terms are equal, i.e. in a first
                          degree polynomial the terms x, y, and z are of degree one. And in second degree polynomial all terms
                          x , y , xy, xz, yz and z  are of degree two. Hence, we observe that after introducing z in a polynomial of
                              2
                                            2
                           2
                          degree n, the terms of the  polynomial still hold the  degree  n. Such polynomials are known as
                          homogeneous polynomials and [x y z] are the homogeneous coordinates.
                          Linear transformations such as translation, scaling, rotation, and shearing can be easily described using
                          homogeneous coordinate system. The point coordinate (x,  y) in two-dimensions is represented by  a
                          vector of three numbers [a b c]. The three components of the vector are interpreted as coordinates in a
                          three-dimensional space. Therefore, a point coordinate (x, y) in two-dimensions is transformed into a
                          homogeneous coordinate system by using a non-zero number z. The homogeneous representation of (x,
                          y) is [zx zy z].
                          Here, the number z is known as the homogeneous coordinate or scale factor.


                                      The point coordinate values can be obtained from the homogeneous representation by
                                      dividing the elements of homogeneous representation by the homogeneous coordinate z.

                                          1.   Point coordinates to Homogeneous representation:
                                                        (x, y)  [zx zy z]
                                          2.   Homogeneous representation to Point coordinates:
                                                        [a b c]  (a/c, b/c)


                                             Consider a point coordinate (2,  3).  This point coordinate is transformed to
                                             homogeneous representation as [2  3 1]. Here, the value of homogeneous
                                             coordinate, ‘z’ is equal to ‘1’. If the value of z=2, then the homogeneous
                                             representation is [4 6 2].
                          The transformation such as scaling and rotation can be done by multiplying the point coordinate matrix
                          with the scaling and rotation matrix respectively, and translation transformation is obtained by adding
                          the translation matrix with the point coordinate matrix.
                          This is a major limitation, since different types of matrix operations have to be performed for different
                          transformations, i.e., if you need to perform transition, scaling, and rotation, you have to first apply
                          transition transformation to  the object, followed by scaling transformation and then rotation
                          transformation.






                          76                      LOVELY PROFESSIONAL UNIVERSITY
   78   79   80   81   82   83   84   85   86   87   88