SlideShare a Scribd company logo
COMPUTER GRAPHICS
CLIPPING
CLIPPING
 Clipping is the process of removing lines or
portions of lines outside an area of interest.
Typically, any line or part thereof which is outside
of the viewing area is removed.
 Clipping Algorithm :
Identifies those portions of a picture that are
either inside or outside of a specified region of
space.
TYPES OF CLIPPING
-Point Clipping
-Line Clipping
-Area Clipping(polygon clipping)
-Curve Clipping
-Text Clipping
Point Clipping
 For a point (x,y) to be inside the clip rectangle:
(xmin, ymin)
(xmax, ymax)
x = xmin x = xmax
y = ymin
y = ymax
(x1, y1)
clip
rectangle
Point Clipping
Clip window: rectangle, edges of the clip window
(xwmin, xwmax, ywmin, ywmax)
If xwmin  x  xwmax
ywmin  y ywmax
Then
(not saved for
The point p = (x, y) is saved
for display
Otherwise: the point is clipped
display).
Line Clipping
Before clipping After clipping
Line clipping against a rectangular window
Line Clipping
Inside – Outside test:
 Completely Inside: A line with both endpoints
inside all clipping boundaries, such as the line from
p1 to p2, is saved.
 Completely Outside: A line with both endpoints
outside any one of the clip boundaries, such as the
line from p3 to p4, is not saved.
 If the line is not completely inside or completely
outside, we must perform intersection calculations
with one or more clipping boundaries.
Cohen-Sutherland Line Clipping
 This method speeds up the processing of the line
segment by performing initial tests that reduce the
number of intersections that must be calculated.
 Every line endpoint in a picture is assigned a four-
digit binary code, called region code that identifies
the location of the point relative to the boundaries
of the clipping rectangle.
Bit 4 Bit 3 Bit 2 Bit 1
Above Below Right Left
Cohen-Sutherland Line Clipping
1001 1000 1010
0001
Window
0000 0010
0101 0100 0110
Bit 4
Above
Bit 3
Below
Bit 2
Right
Bit 1
Left
Cohen-Sutherland Line Clipping
Region-code bit values can be determined
as follows:
Bit 1 is the sign bit of x – xwmin
Bit 2 is the sign bit of xwmax – x
Bit 3 is the sign bit of y – ywmin
Bit 4 is the sign bit of ywmax – y
If the sign is negative the bit is set to 1
otherwise is set to 0.
Cohen-Sutherland Line Clipping
 Any lines that has a region code of 0000 for both
endpoint are completely inside, we save these
lines.
 Any lines that have a 1 in the same bit position in
the region-codes for each endpoint are completely
outside and we reject these lines.
 A method that can be used to test lines for total
clipping is to perform the logical AND operation
with both region codes. If the result is not 0000, the
line is completely outside the clipping region.
Cohen-Sutherland Line Clipping
 p1 0100
 p2 1001
 p3 0001
 p4 0100
 p1 AND p2 =0000
 p3 AND p4 =0000
Bit 4
Above
Bit 3
Below
Bit 2
Right
Bit 1
Left
Cohen-Sutherland Line Clipping
 For a line with endpoint (x1, y1) and (x2, y2)
m = (y2 – y1) / (x2 – x1)
 Intersection points with the clipping boundary:
 The intersection with vertical boundary (x=xwmin or
x=xwmax), the y coordinate can be calculated as:
y = y1 + m(x – x1)
 The intersection with a horizontal boundary
(y=ywmin or y=ywmax.), the x coordinate can be
calculated as
x = x1 + (y – y1) / m
Liang-Barsky Line Clipping
Algorithm
1. For each line, calculate the parameters p, q and r:
 p1 = – x, q1 = x1 – xwmin, r1 = q1/ p1
 p2 = x, q2 = xwmax– x1 , r2 = q2/ p2
 p3 = – y, q3 = y1 – ywmin, r3 = q3/ p3
 p4 = y, q4 = ywmax – y1, r1 = q4/ p4
Liang-Barsky Line Clipping
Algorithm
2. Determine the value of u1 is by looking at the
rectangle edges for which the line proceeds from
outside to the inside (pk < 0). The value of u1 is
taken as the largest of the set consisting of 0 and
the various values of r.
3. Determine the value of u2 by examining the
boundaries for which the line proceeds from
inside to the outside (pk > 0). A value of rk is
calculated for each of these boundaries, and the
value of u2 is the minimum of the set consisting
of 1 and the calculated r values.
Liang-Barsky Line Clipping
Algorithm
4. If u1 > u2, the line is completely outside the clip
window and it can be discarded.
5.Otherwise, the endpoints of the clipped line are
calculated from the two values of parameter u.
 If u2 <1
 Otherwise
 If u1 >0
 Otherwise
x= x1+u2 x,
x = x2,
x= x1+u1 x,
x = x1,
y = y1 +u2 y
y = y2
y = y1 +u1 dy
y = y1
Area Clipping (polygon clipping)
To clip a polygon, we cannot directly apply a line-
clipping method to the individual polygon edges
because this approach would produce a series of
unconnected line segments as shown in figure .
Area Clipping (polygon clipping)
 The clipped polygons must be a bounded area after clipping
as shown in figure.
 For polygon clipping, we require an algorithm that will
generate one or more closed areas that are then scan
converted for the appreciate area fill.
 The output of a polygon clipper should be a sequence of
vertices that defines the clipped polygon boundaries.
Sutherland-Hodgman Polygon
Clipping
 Clip a polygon by processing the polygon boundary as a
whole against each window edge.
 Processing all polygon vertices against each clip rectangle
boundary in turn.
 Beginning with the initial set of polygon vertices, we
could first clip the polygon against the left rectangle
boundary to produce a new sequence of vertices
 The new set of vertices could be successively passed to a
right boundary clipper, a bottom boundary clipper, and a
top boundary clipper, a right boundary clipper.
Sutherland-Hodgman Polygon
Clipping
There are four possible cases when processing
vertices in sequence around the perimeter of a
polygon.
As each pair of adjacent polygon vertices is passed
to a next window boundary clipper, we make the
following tests:
Sutherland-Hodgman Polygon
Clipping
1. If the first vertex is outside the window boundary
and the second vertex is inside
 Then , both the intersection point of the polygon
edge with the window boundary and the second
vertex are added to the output vertex list.
Sutherland-Hodgman Polygon
Clipping
window
2. If both input vertices are inside the
boundary.
 Then, only the second vertex is added to the
output vertex list.
Sutherland-Hodgman Polygon
Clipping
3. If the first vertex is inside the window boundary
and the second vertex is outside.
 Then, only the edge intersection with the window
boundary is added to the output vertex list.
Sutherland-Hodgman Polygon
Clipping
4. If both input vertices are outside the window
boundary.
 Then, nothing is added to the output vertex list.
Weiler-Atherton Polygon Clipping
 This algorithm was developed for identifying visible
surfaces, and can be used to clip a fill area that is either a
convex polygon or a concave polygon.
 The basic idea of this algorithm is
proceeding around the polygon edges
that instead of
as vertices are
processed, we will follow the window boundaries.
 The path we follow depends on:
• polygon-processing direction(clockwise or
counterclockwise)
• The pair of polygon vertices
• outside-to-inside or an inside-to-outside.
Weiler-Atherton Polygon Clipping
 For clockwise processing of polygon vertices, we
use the following rules:
• For an outside-to-inside pair of vertices, follow
polygon boundaries.
• For an inside-to-outside pair of vertices, follow
window boundaries in a clockwise direction.
Weiler-Atherton Polygon Clipping
Curve Clipping
Curve clipping procedures will
involve non-linear equations.
So requires more processing
than for objects with linear
Boundaries.
Curve Clipping
 Preliminary test (Test for overlapping)
 -The bounding rectangle for a circle or other curved
object is used to test for overlap with a
rectangular clip window.
 -If the bounding rectangle is completely inside (save
object), completely outside (discard the object)
 -Both cases-no computation is necessary.
 -If bounding rectangle test fails, use computation-
saving approaches.
Curve Clipping
 Circle-coordinate extents of individual quadrants &
then octants are used for preliminary testing before
calculating curve-window intersections
 Ellipse- coordinate extents of individual quadrants
are used.
 If 2 regions overlap, solve the simultaneous line-
curve equations to obtain the clipping intersection
points.
Text Clipping
 There are several techniques that can be used to
provide text clipping in a graphics packages.
 The choice of clipping method depends on how
characters are generated and what requirements
we have for displaying character strings.
Text Clipping
 All-or-none string-clipping
 If all of the string is inside a clip window, we keep
it.
 Otherwise the string is discarded.
Text Clipping
 All-or-none character-clipping
 Here we discard only those characters that are not
completely inside the window
Text Clipping
 Clip the components of individual characters
 We treat characters in much the same way that we
treated lines.
 If an individual character overlaps a clip window
boundary, we clip off the parts of the character that
are outside the window

More Related Content

What's hot

Curve and text clipping
Curve and text clippingCurve and text clipping
Curve and text clipping
Arvind Kumar
 
Curve clipping
Curve clippingCurve clipping
Curve clipping
Mohamed El-Serngawy
 
Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )
Harshana Madusanka Jayamaha
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
Laxman Puri
 
Video display devices
Video display devicesVideo display devices
Video display devices
shalinikarunakaran1
 
Back face detection
Back face detectionBack face detection
Back face detection
Pooja Dixit
 
COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"
Ankit Surti
 
Illumination Models & Shading
Illumination Models & ShadingIllumination Models & Shading
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
anku2266
 
Anti- aliasing computer graphics
Anti- aliasing computer graphicsAnti- aliasing computer graphics
Anti- aliasing computer graphics
Safayet Hossain
 
BRESENHAM’S LINE DRAWING ALGORITHM
BRESENHAM’S  LINE DRAWING ALGORITHMBRESENHAM’S  LINE DRAWING ALGORITHM
BRESENHAM’S LINE DRAWING ALGORITHM
St Mary's College,Thrissur,Kerala
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
Aparna Joshi
 
Z buffer
Z bufferZ buffer
Z buffer
AmitBiswas99
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
Selvakumar Gna
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
Punyajoy Saha
 
Spline representations
Spline representationsSpline representations
Spline representations
Nikhil krishnan
 
Liang barsky Line Clipping Algorithm
Liang barsky Line Clipping AlgorithmLiang barsky Line Clipping Algorithm
Liang barsky Line Clipping Algorithm
Arvind Kumar
 
Color Models Computer Graphics
Color Models Computer GraphicsColor Models Computer Graphics
Color Models Computer Graphics
dhruv141293
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
Pooja Dixit
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination model
Ankit Garg
 

What's hot (20)

Curve and text clipping
Curve and text clippingCurve and text clipping
Curve and text clipping
 
Curve clipping
Curve clippingCurve clipping
Curve 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
 
Video display devices
Video display devicesVideo display devices
Video display devices
 
Back face detection
Back face detectionBack face detection
Back face detection
 
COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"
 
Illumination Models & Shading
Illumination Models & ShadingIllumination Models & Shading
Illumination Models & Shading
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
 
Anti- aliasing computer graphics
Anti- aliasing computer graphicsAnti- aliasing computer graphics
Anti- aliasing computer graphics
 
BRESENHAM’S LINE DRAWING ALGORITHM
BRESENHAM’S  LINE DRAWING ALGORITHMBRESENHAM’S  LINE DRAWING ALGORITHM
BRESENHAM’S LINE DRAWING ALGORITHM
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
 
Z buffer
Z bufferZ buffer
Z buffer
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Liang barsky Line Clipping Algorithm
Liang barsky Line Clipping AlgorithmLiang barsky Line Clipping Algorithm
Liang barsky Line Clipping Algorithm
 
Color Models Computer Graphics
Color Models Computer GraphicsColor Models Computer Graphics
Color Models Computer Graphics
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination model
 

Similar to Clipping computer graphics

Clipping
ClippingClipping
Clipping
nehrurevathy
 
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
Lahiru Danushka
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
majicyoung
 
Clipping & Rasterization
Clipping & RasterizationClipping & Rasterization
Clipping & Rasterization
Ahmed Daoud
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
ABDULSAMADKAZI
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
Shweta Shah
 
Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
Balamurugan M
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
Amol Gaikwad
 
ibuib.pptx
ibuib.pptxibuib.pptx
ibuib.pptx
nabingyawali5
 
Cohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithmCohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithm
Shilpa Hait
 
Polygon filling
Polygon fillingPolygon filling
Sutherland hodgman polygon clipping algorithm
Sutherland hodgman polygon clipping algorithmSutherland hodgman polygon clipping algorithm
Sutherland hodgman polygon clipping algorithm
Tawfiq Ahmed
 
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
avelraj
 
ohu.pptx
ohu.pptxohu.pptx
ohu.pptx
nabingyawali5
 
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
IJMER
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptx
RYZEN14
 
Clipping
ClippingClipping
Clipping
Udayan Gupta
 
UNIT2.pptx
UNIT2.pptxUNIT2.pptx
UNIT2.pptx
ShwetaShah754701
 
line clipping
line clipping line clipping
line clipping
Saurabh Soni
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
Ankit Garg
 

Similar to Clipping computer graphics (20)

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
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
 
Clipping & Rasterization
Clipping & RasterizationClipping & Rasterization
Clipping & Rasterization
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
ibuib.pptx
ibuib.pptxibuib.pptx
ibuib.pptx
 
Cohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithmCohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithm
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Sutherland hodgman polygon clipping algorithm
Sutherland hodgman polygon clipping algorithmSutherland hodgman polygon clipping algorithm
Sutherland hodgman polygon 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
 
ohu.pptx
ohu.pptxohu.pptx
ohu.pptx
 
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
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptx
 
Clipping
ClippingClipping
Clipping
 
UNIT2.pptx
UNIT2.pptxUNIT2.pptx
UNIT2.pptx
 
line clipping
line clipping line clipping
line clipping
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 

More from ShaishavShah8

Diffie hellman key algorithm
Diffie hellman key algorithmDiffie hellman key algorithm
Diffie hellman key algorithm
ShaishavShah8
 
Constructor oopj
Constructor oopjConstructor oopj
Constructor oopj
ShaishavShah8
 
Classification of debuggers sp
Classification of debuggers spClassification of debuggers sp
Classification of debuggers sp
ShaishavShah8
 
Parallel and perspective projection in 3 d cg
Parallel and perspective projection in 3 d cgParallel and perspective projection in 3 d cg
Parallel and perspective projection in 3 d cg
ShaishavShah8
 
Asymptotic notations ada
Asymptotic notations adaAsymptotic notations ada
Asymptotic notations ada
ShaishavShah8
 
Arrays in java oopj
Arrays in java oopjArrays in java oopj
Arrays in java oopj
ShaishavShah8
 
Classical cyphers python programming
Classical cyphers python programmingClassical cyphers python programming
Classical cyphers python programming
ShaishavShah8
 
Logics for non monotonic reasoning-ai
Logics for non monotonic reasoning-aiLogics for non monotonic reasoning-ai
Logics for non monotonic reasoning-ai
ShaishavShah8
 
Rdd transformations bda
Rdd transformations bdaRdd transformations bda
Rdd transformations bda
ShaishavShah8
 
Introduction to data warehouse dmbi
Introduction to data warehouse dmbiIntroduction to data warehouse dmbi
Introduction to data warehouse dmbi
ShaishavShah8
 
Lan, wan, man mcwc
Lan, wan, man mcwcLan, wan, man mcwc
Lan, wan, man mcwc
ShaishavShah8
 
Introduction to xml, uses of xml wt
Introduction to xml, uses of xml wtIntroduction to xml, uses of xml wt
Introduction to xml, uses of xml wt
ShaishavShah8
 
Agile process se
Agile process seAgile process se
Agile process se
ShaishavShah8
 
Applications of huffman coding dcdr
Applications of huffman coding dcdrApplications of huffman coding dcdr
Applications of huffman coding dcdr
ShaishavShah8
 
Cookie management using jsp a java
Cookie management using jsp  a javaCookie management using jsp  a java
Cookie management using jsp a java
ShaishavShah8
 
Login control .net
Login control .netLogin control .net
Login control .net
ShaishavShah8
 
Rdd transformations
Rdd transformationsRdd transformations
Rdd transformations
ShaishavShah8
 
LAN, WAN, MAN
LAN, WAN, MANLAN, WAN, MAN
LAN, WAN, MAN
ShaishavShah8
 
Introduction to data warehouse
Introduction to data warehouseIntroduction to data warehouse
Introduction to data warehouse
ShaishavShah8
 

More from ShaishavShah8 (19)

Diffie hellman key algorithm
Diffie hellman key algorithmDiffie hellman key algorithm
Diffie hellman key algorithm
 
Constructor oopj
Constructor oopjConstructor oopj
Constructor oopj
 
Classification of debuggers sp
Classification of debuggers spClassification of debuggers sp
Classification of debuggers sp
 
Parallel and perspective projection in 3 d cg
Parallel and perspective projection in 3 d cgParallel and perspective projection in 3 d cg
Parallel and perspective projection in 3 d cg
 
Asymptotic notations ada
Asymptotic notations adaAsymptotic notations ada
Asymptotic notations ada
 
Arrays in java oopj
Arrays in java oopjArrays in java oopj
Arrays in java oopj
 
Classical cyphers python programming
Classical cyphers python programmingClassical cyphers python programming
Classical cyphers python programming
 
Logics for non monotonic reasoning-ai
Logics for non monotonic reasoning-aiLogics for non monotonic reasoning-ai
Logics for non monotonic reasoning-ai
 
Rdd transformations bda
Rdd transformations bdaRdd transformations bda
Rdd transformations bda
 
Introduction to data warehouse dmbi
Introduction to data warehouse dmbiIntroduction to data warehouse dmbi
Introduction to data warehouse dmbi
 
Lan, wan, man mcwc
Lan, wan, man mcwcLan, wan, man mcwc
Lan, wan, man mcwc
 
Introduction to xml, uses of xml wt
Introduction to xml, uses of xml wtIntroduction to xml, uses of xml wt
Introduction to xml, uses of xml wt
 
Agile process se
Agile process seAgile process se
Agile process se
 
Applications of huffman coding dcdr
Applications of huffman coding dcdrApplications of huffman coding dcdr
Applications of huffman coding dcdr
 
Cookie management using jsp a java
Cookie management using jsp  a javaCookie management using jsp  a java
Cookie management using jsp a java
 
Login control .net
Login control .netLogin control .net
Login control .net
 
Rdd transformations
Rdd transformationsRdd transformations
Rdd transformations
 
LAN, WAN, MAN
LAN, WAN, MANLAN, WAN, MAN
LAN, WAN, MAN
 
Introduction to data warehouse
Introduction to data warehouseIntroduction to data warehouse
Introduction to data warehouse
 

Recently uploaded

Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
Fwdays
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
FilipTomaszewski5
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
DianaGray10
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
HarpalGohil4
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
ScyllaDB
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 

Recently uploaded (20)

Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 

Clipping computer graphics

  • 2. CLIPPING  Clipping is the process of removing lines or portions of lines outside an area of interest. Typically, any line or part thereof which is outside of the viewing area is removed.  Clipping Algorithm : Identifies those portions of a picture that are either inside or outside of a specified region of space.
  • 3. TYPES OF CLIPPING -Point Clipping -Line Clipping -Area Clipping(polygon clipping) -Curve Clipping -Text Clipping
  • 4. Point Clipping  For a point (x,y) to be inside the clip rectangle: (xmin, ymin) (xmax, ymax) x = xmin x = xmax y = ymin y = ymax (x1, y1) clip rectangle
  • 5. Point Clipping Clip window: rectangle, edges of the clip window (xwmin, xwmax, ywmin, ywmax) If xwmin  x  xwmax ywmin  y ywmax Then (not saved for The point p = (x, y) is saved for display Otherwise: the point is clipped display).
  • 6. Line Clipping Before clipping After clipping Line clipping against a rectangular window
  • 7. Line Clipping Inside – Outside test:  Completely Inside: A line with both endpoints inside all clipping boundaries, such as the line from p1 to p2, is saved.  Completely Outside: A line with both endpoints outside any one of the clip boundaries, such as the line from p3 to p4, is not saved.  If the line is not completely inside or completely outside, we must perform intersection calculations with one or more clipping boundaries.
  • 8. Cohen-Sutherland Line Clipping  This method speeds up the processing of the line segment by performing initial tests that reduce the number of intersections that must be calculated.  Every line endpoint in a picture is assigned a four- digit binary code, called region code that identifies the location of the point relative to the boundaries of the clipping rectangle. Bit 4 Bit 3 Bit 2 Bit 1 Above Below Right Left
  • 9. Cohen-Sutherland Line Clipping 1001 1000 1010 0001 Window 0000 0010 0101 0100 0110 Bit 4 Above Bit 3 Below Bit 2 Right Bit 1 Left
  • 10. Cohen-Sutherland Line Clipping Region-code bit values can be determined as follows: Bit 1 is the sign bit of x – xwmin Bit 2 is the sign bit of xwmax – x Bit 3 is the sign bit of y – ywmin Bit 4 is the sign bit of ywmax – y If the sign is negative the bit is set to 1 otherwise is set to 0.
  • 11. Cohen-Sutherland Line Clipping  Any lines that has a region code of 0000 for both endpoint are completely inside, we save these lines.  Any lines that have a 1 in the same bit position in the region-codes for each endpoint are completely outside and we reject these lines.  A method that can be used to test lines for total clipping is to perform the logical AND operation with both region codes. If the result is not 0000, the line is completely outside the clipping region.
  • 12. Cohen-Sutherland Line Clipping  p1 0100  p2 1001  p3 0001  p4 0100  p1 AND p2 =0000  p3 AND p4 =0000 Bit 4 Above Bit 3 Below Bit 2 Right Bit 1 Left
  • 13. Cohen-Sutherland Line Clipping  For a line with endpoint (x1, y1) and (x2, y2) m = (y2 – y1) / (x2 – x1)  Intersection points with the clipping boundary:  The intersection with vertical boundary (x=xwmin or x=xwmax), the y coordinate can be calculated as: y = y1 + m(x – x1)  The intersection with a horizontal boundary (y=ywmin or y=ywmax.), the x coordinate can be calculated as x = x1 + (y – y1) / m
  • 14. Liang-Barsky Line Clipping Algorithm 1. For each line, calculate the parameters p, q and r:  p1 = – x, q1 = x1 – xwmin, r1 = q1/ p1  p2 = x, q2 = xwmax– x1 , r2 = q2/ p2  p3 = – y, q3 = y1 – ywmin, r3 = q3/ p3  p4 = y, q4 = ywmax – y1, r1 = q4/ p4
  • 15. Liang-Barsky Line Clipping Algorithm 2. Determine the value of u1 is by looking at the rectangle edges for which the line proceeds from outside to the inside (pk < 0). The value of u1 is taken as the largest of the set consisting of 0 and the various values of r. 3. Determine the value of u2 by examining the boundaries for which the line proceeds from inside to the outside (pk > 0). A value of rk is calculated for each of these boundaries, and the value of u2 is the minimum of the set consisting of 1 and the calculated r values.
  • 16. Liang-Barsky Line Clipping Algorithm 4. If u1 > u2, the line is completely outside the clip window and it can be discarded. 5.Otherwise, the endpoints of the clipped line are calculated from the two values of parameter u.  If u2 <1  Otherwise  If u1 >0  Otherwise x= x1+u2 x, x = x2, x= x1+u1 x, x = x1, y = y1 +u2 y y = y2 y = y1 +u1 dy y = y1
  • 17. Area Clipping (polygon clipping) To clip a polygon, we cannot directly apply a line- clipping method to the individual polygon edges because this approach would produce a series of unconnected line segments as shown in figure .
  • 18. Area Clipping (polygon clipping)  The clipped polygons must be a bounded area after clipping as shown in figure.  For polygon clipping, we require an algorithm that will generate one or more closed areas that are then scan converted for the appreciate area fill.  The output of a polygon clipper should be a sequence of vertices that defines the clipped polygon boundaries.
  • 19. Sutherland-Hodgman Polygon Clipping  Clip a polygon by processing the polygon boundary as a whole against each window edge.  Processing all polygon vertices against each clip rectangle boundary in turn.  Beginning with the initial set of polygon vertices, we could first clip the polygon against the left rectangle boundary to produce a new sequence of vertices  The new set of vertices could be successively passed to a right boundary clipper, a bottom boundary clipper, and a top boundary clipper, a right boundary clipper.
  • 20. Sutherland-Hodgman Polygon Clipping There are four possible cases when processing vertices in sequence around the perimeter of a polygon. As each pair of adjacent polygon vertices is passed to a next window boundary clipper, we make the following tests:
  • 21. Sutherland-Hodgman Polygon Clipping 1. If the first vertex is outside the window boundary and the second vertex is inside  Then , both the intersection point of the polygon edge with the window boundary and the second vertex are added to the output vertex list.
  • 22. Sutherland-Hodgman Polygon Clipping window 2. If both input vertices are inside the boundary.  Then, only the second vertex is added to the output vertex list.
  • 23. Sutherland-Hodgman Polygon Clipping 3. If the first vertex is inside the window boundary and the second vertex is outside.  Then, only the edge intersection with the window boundary is added to the output vertex list.
  • 24. Sutherland-Hodgman Polygon Clipping 4. If both input vertices are outside the window boundary.  Then, nothing is added to the output vertex list.
  • 25. Weiler-Atherton Polygon Clipping  This algorithm was developed for identifying visible surfaces, and can be used to clip a fill area that is either a convex polygon or a concave polygon.  The basic idea of this algorithm is proceeding around the polygon edges that instead of as vertices are processed, we will follow the window boundaries.  The path we follow depends on: • polygon-processing direction(clockwise or counterclockwise) • The pair of polygon vertices • outside-to-inside or an inside-to-outside.
  • 26. Weiler-Atherton Polygon Clipping  For clockwise processing of polygon vertices, we use the following rules: • For an outside-to-inside pair of vertices, follow polygon boundaries. • For an inside-to-outside pair of vertices, follow window boundaries in a clockwise direction.
  • 28. Curve Clipping Curve clipping procedures will involve non-linear equations. So requires more processing than for objects with linear Boundaries.
  • 29. Curve Clipping  Preliminary test (Test for overlapping)  -The bounding rectangle for a circle or other curved object is used to test for overlap with a rectangular clip window.  -If the bounding rectangle is completely inside (save object), completely outside (discard the object)  -Both cases-no computation is necessary.  -If bounding rectangle test fails, use computation- saving approaches.
  • 30. Curve Clipping  Circle-coordinate extents of individual quadrants & then octants are used for preliminary testing before calculating curve-window intersections  Ellipse- coordinate extents of individual quadrants are used.  If 2 regions overlap, solve the simultaneous line- curve equations to obtain the clipping intersection points.
  • 31. Text Clipping  There are several techniques that can be used to provide text clipping in a graphics packages.  The choice of clipping method depends on how characters are generated and what requirements we have for displaying character strings.
  • 32. Text Clipping  All-or-none string-clipping  If all of the string is inside a clip window, we keep it.  Otherwise the string is discarded.
  • 33. Text Clipping  All-or-none character-clipping  Here we discard only those characters that are not completely inside the window
  • 34. Text Clipping  Clip the components of individual characters  We treat characters in much the same way that we treated lines.  If an individual character overlaps a clip window boundary, we clip off the parts of the character that are outside the window