SlideShare a Scribd company logo
1 of 18
Drawing with Thick Primitives Drawing with Thick Primitives • How do we thicken the line stroke width? • Ideas: – Place the center of the circular “brush” on the pixel – Place the upper corner of the square “marker” on the pixel (issues of orientation) – Then do scan conversion algorithm
Why Clip? Rasterization is very expensive Approximately linear with number of fragments created Math and logic per pixel If we only rasterize what is actually viewable, we can save a lot A few operations now can save many later
Clipping Primitives Different primitives can be handled in different ways Points Lines Polygons
159.235 Graphics 4 Viewing & Clipping  - Outline Viewing in 2D Clipping in 2D Cohen-Sutherland Algorithm Cyrus & Beck Algorithm Clipping Polygons Sutherland-Hodgman Algorithm
159.235 Graphics 5 Viewing in 2D - Viewport 250 45 Window in world coordinates. 250 x 250 Pixels. Viewport in Device coords
159.235 Graphics 6 Clipping in 2D Need to clip primitives (eg lines) against the sides of the viewing window e.g lines or polygons We only see what is inside the window
159.235 Graphics 7 Trivial Clipping Acceptance If all a line’s vertices lie inside box we “accept” it
159.235 Graphics 8 Trivial Vertex Rejection All line vertices lie outside and on same side  reject.
159.235 Graphics 9 This is an efficient method of accepting or rejecting lines that do not intersect the window edges. Assign a binary 4 bit code to each vertex : First bit : above top of window, y > ymax Second bit : below bottom, y < ymin Third bit : to right of right edge, x > xmax Fourth bit : to left of left edge, x < xmin 4-bit code called:   Outcode Cohen-Sutherland Clipping Algorithm
Cohen-Sutherland Line Clipping Divide 2D space into 3x3 regions. Middle region is the clipping window. Each region is assigned a 4-bit code. Bit 1 is set to 1 if the region is to the left of the clipping window, 0 otherwise. Similarly for bits 2, 3 and 4. 4 3 2 1 Top         Bottom       Right        Left
Cohen-Sutherland Line Clipping 1010 1000 1001 0000 0010 0001 0100 0110 0101
159.235 Graphics 12 Cohen-Sutherland Algorithm 1001 1000 1010 0000 0001 0010 0100 0110 0101        Both endpoint codes 0000, trivial acceptance, else:                         Do logical AND of Outcodes (reject if  non-zero)
Cohen-Sutherland Line Clipping For those lines that we cannot immediately determine, we successively clip against each boundary. Then check the new endpoint for its region code. How to find boundary intersection: To find y coordinate at vertical intersection, substitute x value at the boundary into the line equation of the line to be clipped. Other algorithms: Faster: Cyrus-Beck Even faster: Liang-Barsky Even faster: Nichol-Lee-Nichol
159.235 Graphics 14 Clipping Polygons Clip polygons by clipping successively against 4 sides.
159.235 Graphics 15 Clipping Polygons Clip polygons by clipping successively against all 4 sides Can implement as pipelined algorithm (ie special hardware  can do the work) Recursively test each edge. Form new edge with next vertex Call with new edge
159.235 Graphics 16 Four cases of polygon clipping: Inside Outside Inside Outside Inside Outside Inside Outside Output Intersection Second Output Case 3 No output. Case 1 Case 2. Case 4 Sutherland-Hodgman Clipping Algorithm First Output Output Vertex
159.235 Graphics 17 Sutherland-Hodgman Algorithm Loop round vertices, test each against all 4 clipping planes in sequence Call algorithm again with new edge formed by next vertex -re-entrant No storage requirement between stages Easy to implement in hardware
18 Viewing & Clipping - Summary Window and Viewport Clipping cuts out what we do not “see” Also reduces  unnecessary computation Can be  done at various levels Java 2D  system does a lot of  the clipping for us if we use that rendering pipeline

More Related Content

What's hot

Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmMaruf Abdullah (Rion)
 
Lecture 2d point,curve,text,line clipping
Lecture   2d point,curve,text,line clippingLecture   2d point,curve,text,line clipping
Lecture 2d point,curve,text,line clippingavelraj
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clippingMani Kanth
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clippingmajicyoung
 
Circle & curve clipping algorithm
Circle & curve clipping algorithmCircle & curve clipping algorithm
Circle & curve clipping algorithmMohamed El-Serngawy
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer GraphicsLaxman Puri
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingMohd Arif
 
Computer Graphic - Clipping
Computer Graphic - ClippingComputer Graphic - Clipping
Computer Graphic - Clipping2013901097
 
Comparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for ImprovementComparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for ImprovementIJMER
 
Clipping in Computer Graphics
Clipping in Computer Graphics Clipping in Computer Graphics
Clipping in Computer Graphics Barani Tharan
 
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithmPolygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithmMani Kanth
 
Sutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithmsSutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithmsRohit Jain
 
Clipping in 2 d
Clipping in 2 dClipping in 2 d
Clipping in 2 dAshiv Khan
 
Line clipping algorithm (Detailed)
Line clipping algorithm (Detailed)Line clipping algorithm (Detailed)
Line clipping algorithm (Detailed)Aamir Sohail
 
The sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmThe sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmMani Kanth
 

What's hot (20)

Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
 
Lecture 2d point,curve,text,line clipping
Lecture   2d point,curve,text,line clippingLecture   2d point,curve,text,line clipping
Lecture 2d point,curve,text,line clipping
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clipping
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
 
Circle & curve clipping algorithm
Circle & curve clipping algorithmCircle & curve clipping algorithm
Circle & curve clipping algorithm
 
06 clipping
06 clipping06 clipping
06 clipping
 
Clipping
ClippingClipping
Clipping
 
Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Computer Graphic - Clipping
Computer Graphic - ClippingComputer Graphic - Clipping
Computer Graphic - Clipping
 
Comparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for ImprovementComparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for Improvement
 
Clipping in Computer Graphics
Clipping in Computer Graphics Clipping in Computer Graphics
Clipping in Computer Graphics
 
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithmPolygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
 
Curve clipping
Curve clippingCurve clipping
Curve clipping
 
Sutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithmsSutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithms
 
Clipping in 2 d
Clipping in 2 dClipping in 2 d
Clipping in 2 d
 
Line clipping algorithm (Detailed)
Line clipping algorithm (Detailed)Line clipping algorithm (Detailed)
Line clipping algorithm (Detailed)
 
The sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmThe sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithm
 
2D viewing
2D viewing2D viewing
2D viewing
 

Viewers also liked

Instagram Assets Presentation
Instagram Assets PresentationInstagram Assets Presentation
Instagram Assets PresentationGiuliano Ambrosio
 
Makeforum2014 - il disegno e i cad (per la stampa 3d)
Makeforum2014 - il disegno e i cad (per la stampa 3d)Makeforum2014 - il disegno e i cad (per la stampa 3d)
Makeforum2014 - il disegno e i cad (per la stampa 3d)Paolo Aliverti
 
Scanner 3D e Reverse Engineering
Scanner 3D e Reverse EngineeringScanner 3D e Reverse Engineering
Scanner 3D e Reverse EngineeringPaolo Aliverti
 
Planet Mercury
Planet MercuryPlanet Mercury
Planet Mercurygonaomi
 
Tutorial per 3D printing
Tutorial per 3D printingTutorial per 3D printing
Tutorial per 3D printingFablab Torino
 
La fabbrica del Design Digitale
La fabbrica del Design DigitaleLa fabbrica del Design Digitale
La fabbrica del Design DigitaleFablab Torino
 
Drawing in practice
Drawing in practiceDrawing in practice
Drawing in practiceShellygwhs
 
Open Makers Italy - L'importanza della prototipazione per la creazione di una...
Open Makers Italy - L'importanza della prototipazione per la creazione di una...Open Makers Italy - L'importanza della prototipazione per la creazione di una...
Open Makers Italy - L'importanza della prototipazione per la creazione di una...Andrea Paraggio
 
ABC: Come rendere un Post Blog su WordPress ottimizzato per i Social Media
ABC: Come rendere un Post Blog su WordPress ottimizzato per i Social MediaABC: Come rendere un Post Blog su WordPress ottimizzato per i Social Media
ABC: Come rendere un Post Blog su WordPress ottimizzato per i Social MediaGiuliano Ambrosio
 
[#CaseStudy] Quel giorno in cui sono diventato @ilWinnerTaco su Twitter
[#CaseStudy] Quel giorno in cui sono diventato @ilWinnerTaco su Twitter[#CaseStudy] Quel giorno in cui sono diventato @ilWinnerTaco su Twitter
[#CaseStudy] Quel giorno in cui sono diventato @ilWinnerTaco su TwitterGiuliano Ambrosio
 
Corso di prototipazione elettronica
Corso di prototipazione elettronicaCorso di prototipazione elettronica
Corso di prototipazione elettronicaPaolo Aliverti
 
La stampa 3D nella scuola: imparare creando
La stampa 3D nella scuola: imparare creandoLa stampa 3D nella scuola: imparare creando
La stampa 3D nella scuola: imparare creandoImpara digitale
 
Tecnologie di Rapid Prototyping e Rapid Manufacturing by Skorpion Engineering
Tecnologie di Rapid Prototyping e Rapid Manufacturing by Skorpion EngineeringTecnologie di Rapid Prototyping e Rapid Manufacturing by Skorpion Engineering
Tecnologie di Rapid Prototyping e Rapid Manufacturing by Skorpion EngineeringSkorpion Engineering Srl
 

Viewers also liked (20)

Mars
MarsMars
Mars
 
Instagram Assets Presentation
Instagram Assets PresentationInstagram Assets Presentation
Instagram Assets Presentation
 
Makeforum2014 - il disegno e i cad (per la stampa 3d)
Makeforum2014 - il disegno e i cad (per la stampa 3d)Makeforum2014 - il disegno e i cad (per la stampa 3d)
Makeforum2014 - il disegno e i cad (per la stampa 3d)
 
#LaForza
#LaForza#LaForza
#LaForza
 
Scanner 3D e Reverse Engineering
Scanner 3D e Reverse EngineeringScanner 3D e Reverse Engineering
Scanner 3D e Reverse Engineering
 
Creativity and graphic design 2
Creativity and graphic design 2Creativity and graphic design 2
Creativity and graphic design 2
 
Planet Mercury
Planet MercuryPlanet Mercury
Planet Mercury
 
Tutorial per 3D printing
Tutorial per 3D printingTutorial per 3D printing
Tutorial per 3D printing
 
La fabbrica del Design Digitale
La fabbrica del Design DigitaleLa fabbrica del Design Digitale
La fabbrica del Design Digitale
 
Social Brand Day #SBDAY14
Social Brand Day #SBDAY14Social Brand Day #SBDAY14
Social Brand Day #SBDAY14
 
Drawing in practice
Drawing in practiceDrawing in practice
Drawing in practice
 
Creativity and graphic design 1
Creativity and graphic design 1Creativity and graphic design 1
Creativity and graphic design 1
 
Open Makers Italy - L'importanza della prototipazione per la creazione di una...
Open Makers Italy - L'importanza della prototipazione per la creazione di una...Open Makers Italy - L'importanza della prototipazione per la creazione di una...
Open Makers Italy - L'importanza della prototipazione per la creazione di una...
 
ABC: Come rendere un Post Blog su WordPress ottimizzato per i Social Media
ABC: Come rendere un Post Blog su WordPress ottimizzato per i Social MediaABC: Come rendere un Post Blog su WordPress ottimizzato per i Social Media
ABC: Come rendere un Post Blog su WordPress ottimizzato per i Social Media
 
[#CaseStudy] Quel giorno in cui sono diventato @ilWinnerTaco su Twitter
[#CaseStudy] Quel giorno in cui sono diventato @ilWinnerTaco su Twitter[#CaseStudy] Quel giorno in cui sono diventato @ilWinnerTaco su Twitter
[#CaseStudy] Quel giorno in cui sono diventato @ilWinnerTaco su Twitter
 
Corso di prototipazione elettronica
Corso di prototipazione elettronicaCorso di prototipazione elettronica
Corso di prototipazione elettronica
 
La stampa 3D nella scuola: imparare creando
La stampa 3D nella scuola: imparare creandoLa stampa 3D nella scuola: imparare creando
La stampa 3D nella scuola: imparare creando
 
3DPrinting Intro
3DPrinting Intro3DPrinting Intro
3DPrinting Intro
 
Tecnologie di Rapid Prototyping e Rapid Manufacturing by Skorpion Engineering
Tecnologie di Rapid Prototyping e Rapid Manufacturing by Skorpion EngineeringTecnologie di Rapid Prototyping e Rapid Manufacturing by Skorpion Engineering
Tecnologie di Rapid Prototyping e Rapid Manufacturing by Skorpion Engineering
 
Liberta Digitali
Liberta DigitaliLiberta Digitali
Liberta Digitali
 

Similar to Clipping 22 (20)

99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
7-Clipping-16 (1).pdf
7-Clipping-16 (1).pdf7-Clipping-16 (1).pdf
7-Clipping-16 (1).pdf
 
Clipping
ClippingClipping
Clipping
 
lecture8 clipping
lecture8 clippinglecture8 clipping
lecture8 clipping
 
Implementation
ImplementationImplementation
Implementation
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
Clipping
ClippingClipping
Clipping
 
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygonsLiang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
 
Lecture1616_16827_2D Clipping.ppt
Lecture1616_16827_2D Clipping.pptLecture1616_16827_2D Clipping.ppt
Lecture1616_16827_2D Clipping.ppt
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
kgv.pptx
kgv.pptxkgv.pptx
kgv.pptx
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
CAD - Unit-1 (Fundamentals of Computer Graphics)
CAD - Unit-1 (Fundamentals of Computer Graphics)CAD - Unit-1 (Fundamentals of Computer Graphics)
CAD - Unit-1 (Fundamentals of Computer Graphics)
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptx
 
ibuib.pptx
ibuib.pptxibuib.pptx
ibuib.pptx
 
ohu.pptx
ohu.pptxohu.pptx
ohu.pptx
 
Clipping
ClippingClipping
Clipping
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 

Recently uploaded

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Clipping 22

  • 1. Drawing with Thick Primitives Drawing with Thick Primitives • How do we thicken the line stroke width? • Ideas: – Place the center of the circular “brush” on the pixel – Place the upper corner of the square “marker” on the pixel (issues of orientation) – Then do scan conversion algorithm
  • 2. Why Clip? Rasterization is very expensive Approximately linear with number of fragments created Math and logic per pixel If we only rasterize what is actually viewable, we can save a lot A few operations now can save many later
  • 3. Clipping Primitives Different primitives can be handled in different ways Points Lines Polygons
  • 4. 159.235 Graphics 4 Viewing & Clipping - Outline Viewing in 2D Clipping in 2D Cohen-Sutherland Algorithm Cyrus & Beck Algorithm Clipping Polygons Sutherland-Hodgman Algorithm
  • 5. 159.235 Graphics 5 Viewing in 2D - Viewport 250 45 Window in world coordinates. 250 x 250 Pixels. Viewport in Device coords
  • 6. 159.235 Graphics 6 Clipping in 2D Need to clip primitives (eg lines) against the sides of the viewing window e.g lines or polygons We only see what is inside the window
  • 7. 159.235 Graphics 7 Trivial Clipping Acceptance If all a line’s vertices lie inside box we “accept” it
  • 8. 159.235 Graphics 8 Trivial Vertex Rejection All line vertices lie outside and on same side  reject.
  • 9. 159.235 Graphics 9 This is an efficient method of accepting or rejecting lines that do not intersect the window edges. Assign a binary 4 bit code to each vertex : First bit : above top of window, y > ymax Second bit : below bottom, y < ymin Third bit : to right of right edge, x > xmax Fourth bit : to left of left edge, x < xmin 4-bit code called: Outcode Cohen-Sutherland Clipping Algorithm
  • 10. Cohen-Sutherland Line Clipping Divide 2D space into 3x3 regions. Middle region is the clipping window. Each region is assigned a 4-bit code. Bit 1 is set to 1 if the region is to the left of the clipping window, 0 otherwise. Similarly for bits 2, 3 and 4. 4 3 2 1 Top Bottom Right Left
  • 11. Cohen-Sutherland Line Clipping 1010 1000 1001 0000 0010 0001 0100 0110 0101
  • 12. 159.235 Graphics 12 Cohen-Sutherland Algorithm 1001 1000 1010 0000 0001 0010 0100 0110 0101 Both endpoint codes 0000, trivial acceptance, else: Do logical AND of Outcodes (reject if non-zero)
  • 13. Cohen-Sutherland Line Clipping For those lines that we cannot immediately determine, we successively clip against each boundary. Then check the new endpoint for its region code. How to find boundary intersection: To find y coordinate at vertical intersection, substitute x value at the boundary into the line equation of the line to be clipped. Other algorithms: Faster: Cyrus-Beck Even faster: Liang-Barsky Even faster: Nichol-Lee-Nichol
  • 14. 159.235 Graphics 14 Clipping Polygons Clip polygons by clipping successively against 4 sides.
  • 15. 159.235 Graphics 15 Clipping Polygons Clip polygons by clipping successively against all 4 sides Can implement as pipelined algorithm (ie special hardware can do the work) Recursively test each edge. Form new edge with next vertex Call with new edge
  • 16. 159.235 Graphics 16 Four cases of polygon clipping: Inside Outside Inside Outside Inside Outside Inside Outside Output Intersection Second Output Case 3 No output. Case 1 Case 2. Case 4 Sutherland-Hodgman Clipping Algorithm First Output Output Vertex
  • 17. 159.235 Graphics 17 Sutherland-Hodgman Algorithm Loop round vertices, test each against all 4 clipping planes in sequence Call algorithm again with new edge formed by next vertex -re-entrant No storage requirement between stages Easy to implement in hardware
  • 18. 18 Viewing & Clipping - Summary Window and Viewport Clipping cuts out what we do not “see” Also reduces unnecessary computation Can be done at various levels Java 2D system does a lot of the clipping for us if we use that rendering pipeline