Page 164 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 164

Lab on Computer Graphics



                   Notes         Source code for Shearing Algorithm C Programming
                                           #include<stdio.h>
                                           #include<conio.h>
                                           #include<math.h>
                                           #include<graphics.h>
                                           void shearing ()
                                           {
                                           int sh;
                                           float xn 1 , yn 1 , xn 2 , yn 2 ;
                                           printf (“Enter the value of Shearing”);
                                           scanf(“%d”,&sh);
                                           cleardevice();
                                           outtextxy(500,100, “SHEARING”);
                                           xn 1 =x 1 +sh*y 1 ;
                                           yn 1 =y 1 ;
                                           xn 2 =x 2 +sh*y 2 ;
                                           yn 2 =y 2 ;
                                           line(x 1 ,y 1 ,x 2 ,y 2 );
                                           line(xn 1 ,yn 1 ,xn 2 ,yn 2 );
                                           getch();
                                           }

                                 10.2 Rotation

                                 Rotation of a planar body is the movement when points of the body travel in circular trajectories
                                 around a fixed point called the centre of rotation. For a three-dimensional body, the rotation
                                 is  around  an  axis  it  quantity  to  rotation  in  each  plane  perpendicular  to  the  axis  around  the
                                 intersection of the plane and the axis.
                                 An example of rotation of a planar figure around a point is the movement of the propeller of
                                 an aircraft. A door attached to the wall by two or more hinges rotates around the axis going
                                 through the hinges.
                                 If the axis of rotation is within the body, the body is said to rotate upon itself, or spin. Among
                                 such rotations, the simplest case is that of constant angular frequency.

                                 A rotation is a rigid body movement which keeps a point fixed; unlike a translation. This definition
                                 is applicable both for rotations in a plane (two dimensions) and in space (three dimensions).
                                 It turns out that a rotation in the three-dimensional space keeps fixed not just a single point,
                                 but rather an entire line; that is to say, any rotation in the three dimensional space is a rotation
                                 around an axis.
                                 If  one  does  a  rotation  around  a  point  (axis),  followed  by  another  rotation  around  the  same
                                 point (axis), the total result is yet another rotation. The reverse (inverse) of a rotation is also
                                 a rotation. It follows that the rotations around a point or axis form a group. If however one
                                 performs rotation around a point (axis) followed by rotation around another point (axis), the
                                 overall movement may not be a rotation anymore.





        158                               LOVELY PROFESSIONAL UNIVERSITY
   159   160   161   162   163   164   165   166   167   168   169