SlideShare ist ein Scribd-Unternehmen logo
1 von 56
Downloaden Sie, um offline zu lesen
Output Primitives

Organized By: Vinay Arora
               Assistant Professor, CSED
               Thapar University, Patiala
Disclaimer

         This is NOT A COPYRIGHT                           MATERIAL
Content has been taken mainly from the following books & websites:

          Computer Graphics C Version By Donald Hearn, M. Pauline Baker
Schaum's 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
Object Model




               Vinay Arora
                  CSED
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
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
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
Straight lines must appear as Straight
                Lines




                  Vinay Arora
                     CSED
For horizontal, vertical and 45º lines, the choice of raster elements is
obvious. This lines exhibit constant brightness along the length:




                                Vinay Arora
                                   CSED
For any other orientation the choice is more difficult:




                               Vinay Arora
                                  CSED
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
Jaggies




          Vinay Arora
             CSED
Staircase Effect




                   Vinay Arora
                      CSED
Staircase Effect




                   Vinay Arora
                      CSED
Direct Scan Conversion




                Vinay Arora
                   CSED
DDA – Digital Differential Analyzer




                 Vinay Arora
                    CSED
DDA – Pseudo code




               Vinay Arora
                  CSED
Section of Display Screen in case of Positive
                 Slope Line




                      Vinay Arora
                         CSED
Section of Display Screen in case of
        Negative Slope Line




                 Vinay Arora
                    CSED
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
Distance between pixel positions & the line y
    coordinate at sampling position xk+1




                      Vinay Arora
                         CSED
Bresenham’s Algorithm
 They coordinate on mathematical line at pixel column position xk+l is calculated as




                                       Vinay Arora
                                          CSED
Bresenham’s Algorithm (Conti…)




  where term yk+1 - yk is either 0 or 1, depending on the sign of parameter pk.




                                      Vinay Arora
                                         CSED
Algorithm




            Vinay Arora
               CSED
Line Drawing




               Vinay Arora
                  CSED
Example




          Vinay Arora
             CSED
Solution




           Vinay Arora
              CSED
Representation of Circle




                 Vinay Arora
                    CSED
Representation of Circle




                 Vinay Arora
                    CSED
Mid Point Representation




                Vinay Arora
                   CSED
Mid Point Representation




                Vinay Arora
                   CSED
Mid Point Circle Algo. – Basic Steps




                   Vinay Arora
                      CSED
Mid Point Circle Algo. – Basic Steps




                   Vinay Arora
                      CSED
Mid Point Circle Algo. – Basic Steps




                   Vinay Arora
                      CSED
Mid Point Circle Algorithm




                 Vinay Arora
                    CSED
Mid Point Circle Algorithm (Contd)




                 Vinay Arora
                    CSED
Example




          Vinay Arora
             CSED
Ellipse




          Vinay Arora
             CSED
Ellipse (Contd.)




                   Vinay Arora
                      CSED
General Equation




                   Vinay Arora
                      CSED
Scan Converting an Ellipse




                 Vinay Arora
                    CSED
Equation for Ellipse




                 Vinay Arora
                    CSED
Equation for Ellipse – For Region 1




                 Vinay Arora
                    CSED
Scan Line for Polygon Filling




                 Vinay Arora
                    CSED
Scan Line for Polygon Filling




                 Vinay Arora
                    CSED
Selecting Vertex




                   Vinay Arora
                      CSED
Formula for Next Value for x




                 Vinay Arora
                    CSED
Saving Intersection Points




                 Vinay Arora
                    CSED
Color Boundaries for Boundary Fill
           Procedure




                Vinay Arora
                   CSED
4-Connected & 8-Connected




               Vinay Arora
                  CSED
Boundary Fill Algorithm




                Vinay Arora
                   CSED
Partially Filled in 4 - Connected




                  Vinay Arora
                     CSED
Boundary Fill across Pixel spans for a
        4 – connected area




                  Vinay Arora
                     CSED
Boundary Fill across Pixel spans for a
        4 – connected area




                  Vinay Arora
                     CSED
Flood Fill




             Vinay Arora
                CSED
Flood Fill Algorithm




                 Vinay Arora
                    CSED
Thnx…



  Vinay Arora
     CSED

Weitere ähnliche Inhalte

Was ist angesagt?

Video display devices
Video display devicesVideo display devices
Video display devices
Mohd Arif
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
anku2266
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformations
Mohammad Sadiq
 

Was ist angesagt? (20)

Video display devices
Video display devicesVideo display devices
Video display devices
 
Random scan displays and raster scan displays
Random scan displays and raster scan displaysRandom scan displays and raster scan displays
Random scan displays and raster scan displays
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notes
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
 
Output primitives computer graphics c version
Output primitives   computer graphics c versionOutput primitives   computer graphics c version
Output primitives computer graphics c version
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
Parallel projection
Parallel projectionParallel projection
Parallel projection
 
Monitors & workstation,Donald ch-2
Monitors & workstation,Donald ch-2Monitors & workstation,Donald ch-2
Monitors & workstation,Donald ch-2
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
03.Scan Conversion.ppt
03.Scan Conversion.ppt03.Scan Conversion.ppt
03.Scan Conversion.ppt
 
Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniques
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
4. THREE DIMENSIONAL DISPLAY METHODS
4.	THREE DIMENSIONAL DISPLAY METHODS4.	THREE DIMENSIONAL DISPLAY METHODS
4. THREE DIMENSIONAL DISPLAY METHODS
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformations
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 

Andere mochten auch

CG - Input Output Devices
CG - Input Output DevicesCG - Input Output Devices
CG - Input Output Devices
vinay arora
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algo
Mohd Arif
 
Security & Protection
Security & ProtectionSecurity & Protection
Security & Protection
vinay arora
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronization
vinay arora
 
Line drawing algorithms
Line drawing algorithmsLine drawing algorithms
Line drawing algorithms
Susheel Thakur
 

Andere mochten auch (20)

Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
 
Input devices in computer graphics
Input devices in computer graphicsInput devices in computer graphics
Input devices in computer graphics
 
CG - Input Output Devices
CG - Input Output DevicesCG - Input Output Devices
CG - Input Output Devices
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algo
 
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
 
2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)
 
Uta005 lecture2
Uta005 lecture2Uta005 lecture2
Uta005 lecture2
 
Security & Protection
Security & ProtectionSecurity & Protection
Security & Protection
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronization
 
4 java - decision
4  java - decision4  java - decision
4 java - decision
 
Uta005 lecture1
Uta005 lecture1Uta005 lecture1
Uta005 lecture1
 
Rasterization
RasterizationRasterization
Rasterization
 
[C++ GUI Programming with Qt4] chap8
[C++ GUI Programming with Qt4] chap8[C++ GUI Programming with Qt4] chap8
[C++ GUI Programming with Qt4] chap8
 
2 java - operators
2  java - operators2  java - operators
2 java - operators
 
Trading StocksSemanal20/05/2011
Trading StocksSemanal20/05/2011Trading StocksSemanal20/05/2011
Trading StocksSemanal20/05/2011
 
Confessions from Social Media Event Organizers: Taking your brand offline
Confessions from Social Media Event Organizers: Taking your brand offlineConfessions from Social Media Event Organizers: Taking your brand offline
Confessions from Social Media Event Organizers: Taking your brand offline
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Line drawing algorithms
Line drawing algorithmsLine drawing algorithms
Line drawing algorithms
 
Antialiasing
AntialiasingAntialiasing
Antialiasing
 

Mehr von vinay arora (20)

Search engine and web crawler
Search engine and web crawlerSearch engine and web crawler
Search engine and web crawler
 
Use case diagram (airport)
Use case diagram (airport)Use case diagram (airport)
Use case diagram (airport)
 
Use case diagram
Use case diagramUse case diagram
Use case diagram
 
Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)
 
SEM - UML (1st case study)
SEM - UML (1st case study)SEM - UML (1st case study)
SEM - UML (1st case study)
 
6 java - loop
6  java - loop6  java - loop
6 java - loop
 
3 java - variable type
3  java - variable type3  java - variable type
3 java - variable type
 
1 java - data type
1  java - data type1  java - data type
1 java - data type
 
Uta005 lecture3
Uta005 lecture3Uta005 lecture3
Uta005 lecture3
 
CG - Display Devices
CG - Display DevicesCG - Display Devices
CG - Display Devices
 
CG - Introduction to Computer Graphics
CG - Introduction to Computer GraphicsCG - Introduction to Computer Graphics
CG - Introduction to Computer Graphics
 
C Prog. - Strings (Updated)
C Prog. - Strings (Updated)C Prog. - Strings (Updated)
C Prog. - Strings (Updated)
 
C Prog. - Structures
C Prog. - StructuresC Prog. - Structures
C Prog. - Structures
 
A&D - UML
A&D - UMLA&D - UML
A&D - UML
 
A&D - Object Oriented Design using UML
A&D - Object Oriented Design using UMLA&D - Object Oriented Design using UML
A&D - Object Oriented Design using UML
 
C Prog - Strings
C Prog - StringsC Prog - Strings
C Prog - Strings
 
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointers
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
A&D - Input Design
A&D - Input DesignA&D - Input Design
A&D - Input Design
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 

CG - Output Primitives