Title | Computer graphics lab manual |
---|---|
Author | Shivam Sharma |
Course | Computer Graphics |
Institution | Galgotias University |
Pages | 20 |
File Size | 419.9 KB |
File Type | |
Total Downloads | 56 |
Total Views | 160 |
Lab Manual CG...
LIST OF EXPERIMENTS: 1. Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2. Implementation of Line, Circle and ellipse Attributes 3. Two Dimensional transformations - Translation, Rotation, Scaling, Reflection, Shea r. 4. Composite 2D Transformations 5. Cohen Sutherland 2D line clipping and Windowing 6. Sutherland – Hodgeman Polygon clipping Algorithm 7. Three dimensional transformations - Translation, Rotation, Scaling 8. Composite 3D transformations 9. Drawing three dimensional objects and Scenes 10. Generating Fractal images
Experiments 1. AIM:-Implementation of Line by Bresenhams Algorithm Using C. Theory: The Bresenham line algorithm is an algorithm which determines which points in an ndimensional raster should be plotted in order to form a close approximation to a straight line between two given points. It is commonly used to draw lines on a computer screen, as it uses only integer addition, subtraction and bit shifting The algorithm is used in hardware such as plotters and in the graphics chips of modern graphics cards. It can also be found in many software graphics libraries. Because the algorithm is very simple, it is often implemented in either the firmware or the hardware of modern graphics cards Algorithm Step1 Input the two line endpoints and store the left endpoint in (x0,y0) Step2 Load (x0,y0) into the frame buffer; i.e., plot the first point. Step 3 Calculate constants dx,dy,2dy and 2dy-2dx, and obtain the starting value for the decision parameter as P0=2dy-dx Step4 At each xk along the line ,starting at k=0,perform the following test: If pk...