Your SlideShare is downloading. ×
CG - Output Primitives
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

CG - Output Primitives

2,739
views

Published on


0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,739
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
238
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Output PrimitivesOrganized By: Vinay Arora Assistant Professor, CSED Thapar University, Patiala
  • 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. Object Model Vinay Arora CSED
  • 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. 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. 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. Straight lines must appear as Straight Lines Vinay Arora CSED
  • 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. For any other orientation the choice is more difficult: Vinay Arora CSED
  • 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. Jaggies Vinay Arora CSED
  • 12. Staircase Effect Vinay Arora CSED
  • 13. Staircase Effect Vinay Arora CSED
  • 14. Direct Scan Conversion Vinay Arora CSED
  • 15. DDA – Digital Differential Analyzer Vinay Arora CSED
  • 16. DDA – Pseudo code Vinay Arora CSED
  • 17. Section of Display Screen in case of Positive Slope Line Vinay Arora CSED
  • 18. Section of Display Screen in case of Negative Slope Line Vinay Arora CSED
  • 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. Distance between pixel positions & the line y coordinate at sampling position xk+1 Vinay Arora CSED
  • 21. Bresenham’s Algorithm They coordinate on mathematical line at pixel column position xk+l is calculated as Vinay Arora CSED
  • 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. Algorithm Vinay Arora CSED
  • 24. Line Drawing Vinay Arora CSED
  • 25. Example Vinay Arora CSED
  • 26. Solution Vinay Arora CSED
  • 27. Representation of Circle Vinay Arora CSED
  • 28. Representation of Circle Vinay Arora CSED
  • 29. Mid Point Representation Vinay Arora CSED
  • 30. Mid Point Representation Vinay Arora CSED
  • 31. Mid Point Circle Algo. – Basic Steps Vinay Arora CSED
  • 32. Mid Point Circle Algo. – Basic Steps Vinay Arora CSED
  • 33. Mid Point Circle Algo. – Basic Steps Vinay Arora CSED
  • 34. Mid Point Circle Algorithm Vinay Arora CSED
  • 35. Mid Point Circle Algorithm (Contd) Vinay Arora CSED
  • 36. Example Vinay Arora CSED
  • 37. Ellipse Vinay Arora CSED
  • 38. Ellipse (Contd.) Vinay Arora CSED
  • 39. General Equation Vinay Arora CSED
  • 40. Scan Converting an Ellipse Vinay Arora CSED
  • 41. Equation for Ellipse Vinay Arora CSED
  • 42. Equation for Ellipse – For Region 1 Vinay Arora CSED
  • 43. Scan Line for Polygon Filling Vinay Arora CSED
  • 44. Scan Line for Polygon Filling Vinay Arora CSED
  • 45. Selecting Vertex Vinay Arora CSED
  • 46. Formula for Next Value for x Vinay Arora CSED
  • 47. Saving Intersection Points Vinay Arora CSED
  • 48. Color Boundaries for Boundary Fill Procedure Vinay Arora CSED
  • 49. 4-Connected & 8-Connected Vinay Arora CSED
  • 50. Boundary Fill Algorithm Vinay Arora CSED
  • 51. Partially Filled in 4 - Connected Vinay Arora CSED
  • 52. Boundary Fill across Pixel spans for a 4 – connected area Vinay Arora CSED
  • 53. Boundary Fill across Pixel spans for a 4 – connected area Vinay Arora CSED
  • 54. Flood Fill Vinay Arora CSED
  • 55. Flood Fill Algorithm Vinay Arora CSED
  • 56. Thnx… Vinay Arora CSED