Upcoming SlideShare
×

CG - Output Primitives

4,582 views

Published on

2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

Views
Total views
4,582
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
341
0
Likes
2
Embeds 0
No embeds

No notes for slide

CG - Output Primitives

1. 1. Output PrimitivesOrganized By: Vinay Arora Assistant Professor, CSED Thapar University, Patiala
2. 2. Disclaimer This is NOT A COPYRIGHT MATERIALContent has been taken mainly from the following books & websites: Computer Graphics C Version By Donald Hearn, M. Pauline BakerSchaums outline of theory and problems of computer graphics By Zhigang Xiang, Roy A. Plastock Computer Graphics: Principles and Practice By James D. Foley http://en.wikipedia.org/wiki/Computer_graphics http://www.howstuffworks.com/3dgraphics.htm http://www.graphics.cornell.edu/online/tutorial/ http://www.cgarena.com/ etc… Vinay Arora CSED
3. 3. Object Model Vinay Arora CSED
4. 4. Primitives 2-D Drawing or a 3-D Object consist of Graphical Primitives such as Points, Lines, Circles & Filled Polygons. Graphics System or the Application Program convert each primitive from its geometric definition into a set of Pixels that make up the primitive in the Image Space. This Conversion is referred to as SCAN CONVERSION or RASTERIZATION. Vinay Arora CSED
5. 5. Definitions RASTERIZATION: Process of determining which pixels provide the best approximation to a desired line on the screen. SCAN CONVERSION: Combination of rasterization and generating the picture in scan line order. Vinay Arora CSED
6. 6. General Requirement Straight lines must appear as straight lines. They must start and end accurately. Lines should have constant brightness along their length. Lines should drawn rapidly. Vinay Arora CSED
7. 7. Straight lines must appear as Straight Lines Vinay Arora CSED
8. 8. For horizontal, vertical and 45º lines, the choice of raster elements isobvious. This lines exhibit constant brightness along the length: Vinay Arora CSED
9. 9. For any other orientation the choice is more difficult: Vinay Arora CSED
10. 10. Intersection Points In general Line doesn’t pass through Intersection Points. Points are very close & dense that’s why – it appears as Straight Line. We have to find Addressable Pixels. Points Distributed over the line & the most closest to the line. No Addressable Pixel is having any Floating Point number/value. Vinay Arora CSED
11. 11. Jaggies Vinay Arora CSED
12. 12. Staircase Effect Vinay Arora CSED
13. 13. Staircase Effect Vinay Arora CSED
14. 14. Direct Scan Conversion Vinay Arora CSED
15. 15. DDA – Digital Differential Analyzer Vinay Arora CSED
16. 16. DDA – Pseudo code Vinay Arora CSED
17. 17. Section of Display Screen in case of Positive Slope Line Vinay Arora CSED
18. 18. Section of Display Screen in case of Negative Slope Line Vinay Arora CSED
19. 19. Screen Grid showing a Pixel in column xk on scan line yk that is to be plotted along the path of line with slope 0 < m <1 Vinay Arora CSED
20. 20. Distance between pixel positions & the line y coordinate at sampling position xk+1 Vinay Arora CSED
21. 21. Bresenham’s Algorithm They coordinate on mathematical line at pixel column position xk+l is calculated as Vinay Arora CSED
22. 22. Bresenham’s Algorithm (Conti…) where term yk+1 - yk is either 0 or 1, depending on the sign of parameter pk. Vinay Arora CSED
23. 23. Algorithm Vinay Arora CSED
24. 24. Line Drawing Vinay Arora CSED
25. 25. Example Vinay Arora CSED
26. 26. Solution Vinay Arora CSED
27. 27. Representation of Circle Vinay Arora CSED
28. 28. Representation of Circle Vinay Arora CSED
29. 29. Mid Point Representation Vinay Arora CSED
30. 30. Mid Point Representation Vinay Arora CSED
31. 31. Mid Point Circle Algo. – Basic Steps Vinay Arora CSED
32. 32. Mid Point Circle Algo. – Basic Steps Vinay Arora CSED
33. 33. Mid Point Circle Algo. – Basic Steps Vinay Arora CSED
34. 34. Mid Point Circle Algorithm Vinay Arora CSED
35. 35. Mid Point Circle Algorithm (Contd) Vinay Arora CSED
36. 36. Example Vinay Arora CSED
37. 37. Ellipse Vinay Arora CSED
38. 38. Ellipse (Contd.) Vinay Arora CSED
39. 39. General Equation Vinay Arora CSED
40. 40. Scan Converting an Ellipse Vinay Arora CSED
41. 41. Equation for Ellipse Vinay Arora CSED
42. 42. Equation for Ellipse – For Region 1 Vinay Arora CSED
43. 43. Scan Line for Polygon Filling Vinay Arora CSED
44. 44. Scan Line for Polygon Filling Vinay Arora CSED
45. 45. Selecting Vertex Vinay Arora CSED
46. 46. Formula for Next Value for x Vinay Arora CSED
47. 47. Saving Intersection Points Vinay Arora CSED
48. 48. Color Boundaries for Boundary Fill Procedure Vinay Arora CSED
49. 49. 4-Connected & 8-Connected Vinay Arora CSED
50. 50. Boundary Fill Algorithm Vinay Arora CSED
51. 51. Partially Filled in 4 - Connected Vinay Arora CSED
52. 52. Boundary Fill across Pixel spans for a 4 – connected area Vinay Arora CSED
53. 53. Boundary Fill across Pixel spans for a 4 – connected area Vinay Arora CSED
54. 54. Flood Fill Vinay Arora CSED
55. 55. Flood Fill Algorithm Vinay Arora CSED
56. 56. Thnx… Vinay Arora CSED