SlideShare a Scribd company logo
1 of 13
Different cases for Line Clipping
1. Both endpoints of the line lie with in the clipping area. This means that the
line is included completely in the clipping area, so that the whole line must be
drawn.
Clip
rectangle
B
A
B
A
1
Conti….
3. Both end points are located outside the clipping area and the line do not intersect the
clipping area. In the case , the line lies completely outside the clipping area and can be
neglected for the scene.
4. Both endpoints are located outside the clipping area and the line intersect the clipping
area. The two intersection points of the line with the clipping are must be determined.
Only the part of the line between these two intersection points should be drawn.
C
D’
B
A
G’
H'
Clip
rectangle
B
A
D
D’
C
G’
H'
G
H
I’
I
J’
J
E
F
2
Intersection, Calculation and
Clipping
 Line that can not be identified as completely inside a clip window by
these test are checked for intersection with the window boundaries.We
begin the clipping process for a line by comparing an outside endpoint
to a window boundary to determine how much of the line can be
discard . Then the remaining part of the line is checked against the
other boundaries,and we continue until either the line is totally discard
or a section is found inside the window.We set up our algorithm to
check line endpoints against clipping boundaries in the order
left,right,bottom,top.
 TO ilustrate the specific step in clipping line against rectangular
boundary using the Cohen-Suterland algorithm,We show the linein
figure could be processed.
3
Intersection and calculation
clipping
 Q.Intersection point with a clipping boundary can be
calculated using the slope intersect for the line of
equation.
 X min=2,X max=8, y min=2 y max=8
 EF:E(3,10) & F(6,12)
 GH:G(4,1) &H (10,6)
Formula:
 M=Y2-Y1/X2-X1
 Xi=X1+1/m(Yi-Y1)
 Where the x value is set to either Xmin or to a x max
 Yi=Y1+m(Xi-X1)
4
Mid point subdivision algorithm
 This method divide the line into three category:
I. Category 1: Visible line
II. Category 2: not visible line
III. Category 3: candidate for Clipping.
An alternative way to process a line in category 3 is based on binary
search.The line is divided at its midpointsinto two shorter line segments.
Each line in a category three is divided again into shorter segments and
categorized.This bisection and categorization process continue until eavh
line segment that spans across a window boundary reaches a threshold for
line size and all other segments are either in a category 1 (visible) or in
category 2 (Not visible.)
5
Mid-point subdivision algorithm
The mid points coordinates are (x m, y m) of a line joining the points(X1,Y1)and (X2,Y2)
are given by:
X m= X1+X2/2 and
Y M= Y1+Y2/2 Q
P
6
7
8
5
1
I1
I2
2
4
3
Figure: illustrates how midpoint subdivision is used to zoom in onto the two Intersection points I1 and I2 with 10 bisection.
6
Comparison b/w Cohen-Sutherland and Mid-point subdivision clipping Algorithm
• Midpoint subdivision algorithm is a special case of Cohen-sutherland algorithm,
where the intersection is not computed by equation solving. It is computed by a
midpoint approximation method, which is suitable for hardware and it is very
fast and efficient.
• The maximum time is consume in the clipping process is to do intersection calculation
with the window boundaries.
• The Cohen-sutherland algorithm reduces these calculation by first discarding that lines
those can be trivially accepted or rejected.
7
Polygon Clipping
 The simplest curve is a line segment or simply a line. A sequence of line where the
following line starts where the previous one ends is called a polyline. If the last line
segment of the polyline ends where the first line segment started, the polyline is called
a polygon. A polygon is defined by n number of sides in the polygon. We can divide
polygon into two classes.
 A convex polygon is a polygon such that for any two points inside the polygon , all
the point of the line segment connecting them are also inside the polygon. A triangle
is always a convex one.
Polygon
Convex
Polygon
Concave
Polygon
P
Q
8
Conti…
 A Concave polygon is one which is not convex.. A polygon is said to be a concave
if the line joining any two interior points of the polygon does not lies completely
inside the polygon.
 There are four possible cases when processes vertices in sequence around the
parameter of the polygon. As each pair of adjacent polygon vertices is passed to a
window boundary clipper. We make the following test.
P
Q
9
Conti…
 Case 1: If the first vertex is outside the window boundary and second vertex
is inside the window boundary then both the intersection point of a polygon
edge with the window boundary and second vertex are added to the output
vertex list.
 Case 2: If both input vertices are inside the window boundary. Only the
second vertex is added to the Vertex list
Case3: If the first vertex is inside the window boundary and the second
vertex is outside the window boundary then only the edge intersection with the
window boundary is added to the output vertex list.
 Case 4: If both the input vertices are outside the window boundary then
nothing is save to the output list.
10
SUTHERLAND AND HODGEMAN
ALGORITHM(Polygon clipping)
 Polygon clipping is a process of clipping a polygon by considering
the edge of that as different line segments. If a polygon is clipped
against a rectangular window then it is possible that we get various
unconnected edges of a polygon. To get a closed polygon of unconnected
edges we connect theses edges along the side of a clipping window to
form a closed polygon.
 The Sutherland –Hodgeman polygon clipping algorithm clips polygon
against convex clipping windows. The Sutherland Hodgeman Polygon
clipping algorithm may produce connecting lines that were not in the
original polygon. When the subject polygon is concave theses connecting
lines may be undesirable artifacts.
 There are four situation to save vertices in output vertex list.
11
Conti……
1. If the first vertex is outside the window boundary and second vertex is inside the
window boundary then both the intersection point of a polygon edge with the
window boundary and second vertex are added to the output vertex list.Ex:save v1’,v2.
POLYGON
WINDOW(W)
2. If both input vertices are inside the window boundary. Only the second vertex is
added to the Vertex list
POLYGON
WINDOW(w)
V1
V1’
V2
V1
V2
12
Cont…..
3. If the first vertex is inside the window boundary and the second vertex is
outside the window boundary then only the edge intersection with the
window boundary is added to the output vertex list.Ex: v1’, v1.
POLYGON
WINDOW(W)
4. If both the input vertices are outside the window boundary then nothing is
save to the output list.
POLYGON
WINDOW(W)
’
V2
V1
V2
V1’
V1
13

More Related Content

Similar to ytt.pptx (20)

ufyty.pptx
ufyty.pptxufyty.pptx
ufyty.pptx
 
ohu.pptx
ohu.pptxohu.pptx
ohu.pptx
 
ibuib.pptx
ibuib.pptxibuib.pptx
ibuib.pptx
 
yyfty.pptx
yyfty.pptxyyfty.pptx
yyfty.pptx
 
hgfcftc.pptx
hgfcftc.pptxhgfcftc.pptx
hgfcftc.pptx
 
hgfcgf.pptx
hgfcgf.pptxhgfcgf.pptx
hgfcgf.pptx
 
kgv.pptx
kgv.pptxkgv.pptx
kgv.pptx
 
Sutherland hodgman polygon clipping algorithm
Sutherland hodgman polygon clipping algorithmSutherland hodgman polygon clipping algorithm
Sutherland hodgman polygon clipping algorithm
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphics
 
Clipping
ClippingClipping
Clipping
 
Clipping
ClippingClipping
Clipping
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
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
 
line clipping
line clipping line clipping
line clipping
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
lecture8 clipping
lecture8 clippinglecture8 clipping
lecture8 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
 
Clipping
ClippingClipping
Clipping
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 

Recently uploaded

Yale Historical Review Machava Interview PDF Spring 2024
Yale Historical Review Machava Interview PDF Spring 2024Yale Historical Review Machava Interview PDF Spring 2024
Yale Historical Review Machava Interview PDF Spring 2024yalehistoricalreview
 
Tennessee DOT- TEVI Plan coordination & EV
Tennessee DOT- TEVI Plan coordination & EVTennessee DOT- TEVI Plan coordination & EV
Tennessee DOT- TEVI Plan coordination & EVRPO America
 
YHRGeorgetown Spring 2024 America should Take Her Share
YHRGeorgetown Spring 2024 America should Take Her ShareYHRGeorgetown Spring 2024 America should Take Her Share
YHRGeorgetown Spring 2024 America should Take Her Shareyalehistoricalreview
 
World Wildlife Crime Report 2024 - Introduction
World Wildlife Crime Report 2024 - IntroductionWorld Wildlife Crime Report 2024 - Introduction
World Wildlife Crime Report 2024 - IntroductionChristina Parmionova
 
Harbin-Gross-Spring2022.pdf Yale Historical Review
Harbin-Gross-Spring2022.pdf Yale Historical ReviewHarbin-Gross-Spring2022.pdf Yale Historical Review
Harbin-Gross-Spring2022.pdf Yale Historical Reviewyalehistoricalreview
 
World Migratory Bird day 2024; May 11 and October 12
World Migratory Bird day 2024; May 11 and October 12World Migratory Bird day 2024; May 11 and October 12
World Migratory Bird day 2024; May 11 and October 12Christina Parmionova
 
Rocky Mount Greenville Willson Regional Transit Plan
Rocky Mount Greenville Willson Regional Transit PlanRocky Mount Greenville Willson Regional Transit Plan
Rocky Mount Greenville Willson Regional Transit PlanRobert Hiett
 
学校原版(um毕业证书)马来亚大学毕业证电子版学位证书原版一模一样
学校原版(um毕业证书)马来亚大学毕业证电子版学位证书原版一模一样学校原版(um毕业证书)马来亚大学毕业证电子版学位证书原版一模一样
学校原版(um毕业证书)马来亚大学毕业证电子版学位证书原版一模一样xunbfu
 
EDI Executive Education MasterClass- 15thMay 2024 (updated).pdf
EDI Executive Education MasterClass- 15thMay 2024 (updated).pdfEDI Executive Education MasterClass- 15thMay 2024 (updated).pdf
EDI Executive Education MasterClass- 15thMay 2024 (updated).pdfEnergy for One World
 
The 2024 World Wildlife Crime Report tracks all these issues, trends and more...
The 2024 World Wildlife Crime Report tracks all these issues, trends and more...The 2024 World Wildlife Crime Report tracks all these issues, trends and more...
The 2024 World Wildlife Crime Report tracks all these issues, trends and more...Christina Parmionova
 
PPT Item # 9 2ndQTR Financial & Inv. Report
PPT Item # 9 2ndQTR Financial & Inv. ReportPPT Item # 9 2ndQTR Financial & Inv. Report
PPT Item # 9 2ndQTR Financial & Inv. Reportahcitycouncil
 
IEA Global Critical Minerals Outlook2024
IEA Global Critical Minerals Outlook2024IEA Global Critical Minerals Outlook2024
IEA Global Critical Minerals Outlook2024Energy for One World
 
PPT Item # 7&8 6900 Broadway P&Z Case # 438
PPT Item # 7&8 6900 Broadway P&Z Case # 438PPT Item # 7&8 6900 Broadway P&Z Case # 438
PPT Item # 7&8 6900 Broadway P&Z Case # 438ahcitycouncil
 
Electric vehicle infrastructure in rural areas
Electric vehicle infrastructure in rural areasElectric vehicle infrastructure in rural areas
Electric vehicle infrastructure in rural areasRPO America
 
2024: The FAR - Federal Acquisition Regulations, Part 34
2024: The FAR - Federal Acquisition Regulations, Part 342024: The FAR - Federal Acquisition Regulations, Part 34
2024: The FAR - Federal Acquisition Regulations, Part 34JSchaus & Associates
 
Topical Guide for RID 3830 Public Image Training Series.ppsx
Topical Guide for RID 3830 Public Image Training Series.ppsxTopical Guide for RID 3830 Public Image Training Series.ppsx
Topical Guide for RID 3830 Public Image Training Series.ppsxAnbr Cama
 
PPT Item # 5 -- Announcements Powerpoint
PPT Item # 5 -- Announcements PowerpointPPT Item # 5 -- Announcements Powerpoint
PPT Item # 5 -- Announcements Powerpointahcitycouncil
 
Value, protect, respect and invest in our nuses for a sustainable future for ...
Value, protect, respect and invest in our nuses for a sustainable future for ...Value, protect, respect and invest in our nuses for a sustainable future for ...
Value, protect, respect and invest in our nuses for a sustainable future for ...Christina Parmionova
 

Recently uploaded (20)

Yale Historical Review Machava Interview PDF Spring 2024
Yale Historical Review Machava Interview PDF Spring 2024Yale Historical Review Machava Interview PDF Spring 2024
Yale Historical Review Machava Interview PDF Spring 2024
 
Tennessee DOT- TEVI Plan coordination & EV
Tennessee DOT- TEVI Plan coordination & EVTennessee DOT- TEVI Plan coordination & EV
Tennessee DOT- TEVI Plan coordination & EV
 
How to Save a Place: Get the Word Out Far And Wide
How to Save a Place: Get the Word Out Far And WideHow to Save a Place: Get the Word Out Far And Wide
How to Save a Place: Get the Word Out Far And Wide
 
YHRGeorgetown Spring 2024 America should Take Her Share
YHRGeorgetown Spring 2024 America should Take Her ShareYHRGeorgetown Spring 2024 America should Take Her Share
YHRGeorgetown Spring 2024 America should Take Her Share
 
World Wildlife Crime Report 2024 - Introduction
World Wildlife Crime Report 2024 - IntroductionWorld Wildlife Crime Report 2024 - Introduction
World Wildlife Crime Report 2024 - Introduction
 
Harbin-Gross-Spring2022.pdf Yale Historical Review
Harbin-Gross-Spring2022.pdf Yale Historical ReviewHarbin-Gross-Spring2022.pdf Yale Historical Review
Harbin-Gross-Spring2022.pdf Yale Historical Review
 
World Migratory Bird day 2024; May 11 and October 12
World Migratory Bird day 2024; May 11 and October 12World Migratory Bird day 2024; May 11 and October 12
World Migratory Bird day 2024; May 11 and October 12
 
Rocky Mount Greenville Willson Regional Transit Plan
Rocky Mount Greenville Willson Regional Transit PlanRocky Mount Greenville Willson Regional Transit Plan
Rocky Mount Greenville Willson Regional Transit Plan
 
学校原版(um毕业证书)马来亚大学毕业证电子版学位证书原版一模一样
学校原版(um毕业证书)马来亚大学毕业证电子版学位证书原版一模一样学校原版(um毕业证书)马来亚大学毕业证电子版学位证书原版一模一样
学校原版(um毕业证书)马来亚大学毕业证电子版学位证书原版一模一样
 
EDI Executive Education MasterClass- 15thMay 2024 (updated).pdf
EDI Executive Education MasterClass- 15thMay 2024 (updated).pdfEDI Executive Education MasterClass- 15thMay 2024 (updated).pdf
EDI Executive Education MasterClass- 15thMay 2024 (updated).pdf
 
The 2024 World Wildlife Crime Report tracks all these issues, trends and more...
The 2024 World Wildlife Crime Report tracks all these issues, trends and more...The 2024 World Wildlife Crime Report tracks all these issues, trends and more...
The 2024 World Wildlife Crime Report tracks all these issues, trends and more...
 
PPT Item # 9 2ndQTR Financial & Inv. Report
PPT Item # 9 2ndQTR Financial & Inv. ReportPPT Item # 9 2ndQTR Financial & Inv. Report
PPT Item # 9 2ndQTR Financial & Inv. Report
 
IEA Global Critical Minerals Outlook2024
IEA Global Critical Minerals Outlook2024IEA Global Critical Minerals Outlook2024
IEA Global Critical Minerals Outlook2024
 
PPT Item # 7&8 6900 Broadway P&Z Case # 438
PPT Item # 7&8 6900 Broadway P&Z Case # 438PPT Item # 7&8 6900 Broadway P&Z Case # 438
PPT Item # 7&8 6900 Broadway P&Z Case # 438
 
The Outlook for the Budget and the Economy
The Outlook for the Budget and the EconomyThe Outlook for the Budget and the Economy
The Outlook for the Budget and the Economy
 
Electric vehicle infrastructure in rural areas
Electric vehicle infrastructure in rural areasElectric vehicle infrastructure in rural areas
Electric vehicle infrastructure in rural areas
 
2024: The FAR - Federal Acquisition Regulations, Part 34
2024: The FAR - Federal Acquisition Regulations, Part 342024: The FAR - Federal Acquisition Regulations, Part 34
2024: The FAR - Federal Acquisition Regulations, Part 34
 
Topical Guide for RID 3830 Public Image Training Series.ppsx
Topical Guide for RID 3830 Public Image Training Series.ppsxTopical Guide for RID 3830 Public Image Training Series.ppsx
Topical Guide for RID 3830 Public Image Training Series.ppsx
 
PPT Item # 5 -- Announcements Powerpoint
PPT Item # 5 -- Announcements PowerpointPPT Item # 5 -- Announcements Powerpoint
PPT Item # 5 -- Announcements Powerpoint
 
Value, protect, respect and invest in our nuses for a sustainable future for ...
Value, protect, respect and invest in our nuses for a sustainable future for ...Value, protect, respect and invest in our nuses for a sustainable future for ...
Value, protect, respect and invest in our nuses for a sustainable future for ...
 

ytt.pptx

  • 1. Different cases for Line Clipping 1. Both endpoints of the line lie with in the clipping area. This means that the line is included completely in the clipping area, so that the whole line must be drawn. Clip rectangle B A B A 1
  • 2. Conti…. 3. Both end points are located outside the clipping area and the line do not intersect the clipping area. In the case , the line lies completely outside the clipping area and can be neglected for the scene. 4. Both endpoints are located outside the clipping area and the line intersect the clipping area. The two intersection points of the line with the clipping are must be determined. Only the part of the line between these two intersection points should be drawn. C D’ B A G’ H' Clip rectangle B A D D’ C G’ H' G H I’ I J’ J E F 2
  • 3. Intersection, Calculation and Clipping  Line that can not be identified as completely inside a clip window by these test are checked for intersection with the window boundaries.We begin the clipping process for a line by comparing an outside endpoint to a window boundary to determine how much of the line can be discard . Then the remaining part of the line is checked against the other boundaries,and we continue until either the line is totally discard or a section is found inside the window.We set up our algorithm to check line endpoints against clipping boundaries in the order left,right,bottom,top.  TO ilustrate the specific step in clipping line against rectangular boundary using the Cohen-Suterland algorithm,We show the linein figure could be processed. 3
  • 4. Intersection and calculation clipping  Q.Intersection point with a clipping boundary can be calculated using the slope intersect for the line of equation.  X min=2,X max=8, y min=2 y max=8  EF:E(3,10) & F(6,12)  GH:G(4,1) &H (10,6) Formula:  M=Y2-Y1/X2-X1  Xi=X1+1/m(Yi-Y1)  Where the x value is set to either Xmin or to a x max  Yi=Y1+m(Xi-X1) 4
  • 5. Mid point subdivision algorithm  This method divide the line into three category: I. Category 1: Visible line II. Category 2: not visible line III. Category 3: candidate for Clipping. An alternative way to process a line in category 3 is based on binary search.The line is divided at its midpointsinto two shorter line segments. Each line in a category three is divided again into shorter segments and categorized.This bisection and categorization process continue until eavh line segment that spans across a window boundary reaches a threshold for line size and all other segments are either in a category 1 (visible) or in category 2 (Not visible.) 5
  • 6. Mid-point subdivision algorithm The mid points coordinates are (x m, y m) of a line joining the points(X1,Y1)and (X2,Y2) are given by: X m= X1+X2/2 and Y M= Y1+Y2/2 Q P 6 7 8 5 1 I1 I2 2 4 3 Figure: illustrates how midpoint subdivision is used to zoom in onto the two Intersection points I1 and I2 with 10 bisection. 6
  • 7. Comparison b/w Cohen-Sutherland and Mid-point subdivision clipping Algorithm • Midpoint subdivision algorithm is a special case of Cohen-sutherland algorithm, where the intersection is not computed by equation solving. It is computed by a midpoint approximation method, which is suitable for hardware and it is very fast and efficient. • The maximum time is consume in the clipping process is to do intersection calculation with the window boundaries. • The Cohen-sutherland algorithm reduces these calculation by first discarding that lines those can be trivially accepted or rejected. 7
  • 8. Polygon Clipping  The simplest curve is a line segment or simply a line. A sequence of line where the following line starts where the previous one ends is called a polyline. If the last line segment of the polyline ends where the first line segment started, the polyline is called a polygon. A polygon is defined by n number of sides in the polygon. We can divide polygon into two classes.  A convex polygon is a polygon such that for any two points inside the polygon , all the point of the line segment connecting them are also inside the polygon. A triangle is always a convex one. Polygon Convex Polygon Concave Polygon P Q 8
  • 9. Conti…  A Concave polygon is one which is not convex.. A polygon is said to be a concave if the line joining any two interior points of the polygon does not lies completely inside the polygon.  There are four possible cases when processes vertices in sequence around the parameter of the polygon. As each pair of adjacent polygon vertices is passed to a window boundary clipper. We make the following test. P Q 9
  • 10. Conti…  Case 1: If the first vertex is outside the window boundary and second vertex is inside the window boundary then both the intersection point of a polygon edge with the window boundary and second vertex are added to the output vertex list.  Case 2: If both input vertices are inside the window boundary. Only the second vertex is added to the Vertex list Case3: If the first vertex is inside the window boundary and the second vertex is outside the window boundary then only the edge intersection with the window boundary is added to the output vertex list.  Case 4: If both the input vertices are outside the window boundary then nothing is save to the output list. 10
  • 11. SUTHERLAND AND HODGEMAN ALGORITHM(Polygon clipping)  Polygon clipping is a process of clipping a polygon by considering the edge of that as different line segments. If a polygon is clipped against a rectangular window then it is possible that we get various unconnected edges of a polygon. To get a closed polygon of unconnected edges we connect theses edges along the side of a clipping window to form a closed polygon.  The Sutherland –Hodgeman polygon clipping algorithm clips polygon against convex clipping windows. The Sutherland Hodgeman Polygon clipping algorithm may produce connecting lines that were not in the original polygon. When the subject polygon is concave theses connecting lines may be undesirable artifacts.  There are four situation to save vertices in output vertex list. 11
  • 12. Conti…… 1. If the first vertex is outside the window boundary and second vertex is inside the window boundary then both the intersection point of a polygon edge with the window boundary and second vertex are added to the output vertex list.Ex:save v1’,v2. POLYGON WINDOW(W) 2. If both input vertices are inside the window boundary. Only the second vertex is added to the Vertex list POLYGON WINDOW(w) V1 V1’ V2 V1 V2 12
  • 13. Cont….. 3. If the first vertex is inside the window boundary and the second vertex is outside the window boundary then only the edge intersection with the window boundary is added to the output vertex list.Ex: v1’, v1. POLYGON WINDOW(W) 4. If both the input vertices are outside the window boundary then nothing is save to the output list. POLYGON WINDOW(W) ’ V2 V1 V2 V1’ V1 13