SlideShare a Scribd company logo
1 of 16
Group 6 Presentation
Name
Takudzwa Mutambu
Ngonidzashe Mwendera
Gerald Matanhire
Devotion Masikati
Tapiwanashe Gwena
Shamiso Khumbula
Kelvin Dube
Assani Saidi
Reg Number
R192975T
R197295X
R1912448M
R1915853W
R1912331Z
R1913840M
R175251T
R194565B
Introduction
• The line clipping is a process in which we can cut the part of the line,
which lies outside the view pane. Only those lines are visible, which lie
inside the view pane.
• The Cohen-Sutherland line clipping algorithm is a common method
used in computer graphics to efficiently clip lines against a rectangular
clipping window. Line clipping is an important task in computer
graphics because it allows us to selectively display only the portions of
a line that are visible within a given viewport or window while
discarding the portions that lie outside of it. This can improve the
overall performance and visual quality of a graphics application,
particularly when rendering complex scenes.
• In this presentation, we will introduce the Cohen-Sutherland line
clipping algorithm, explain how it works, demonstrate its use with an
example, discuss its advantages and limitations.
Cohen-Sutherland Line Clipping
Algorithm
View Plane
How the algorithm works
• We will divide the view pane into nine equal segments that only serve the
viewport.
• We will represent the top, bottom, left, and right corner of the window with
4 bits. These 4 bits can be described with the following point:
• If an object lies within any particular corner position, that corner value will
be 1, else it will be 0.
• The allocation of bits depends on “TBRL” (Top, Bottom, Right, Left) rule.
• Suppose, if the point of a line appears in the top-left corner, then according
to TBRL, the value is 1001. We will allot the bits as-
• For the top corner, because the object is present at the top corner.
• For the bottom corner, because the object does not lie at the bottom.
• For the right corner, because the object does not lie at the right side.
• For the left corner, because the object lies at the top-left corner.
• In this way, we check TBRL for each segment and allot the bits accordingly.
Illustration of the TBRL rule
Line Viewing
• In Cohen- Sutherland Algorithm we will divide the lines into
following Sections
• Visible Line: When both points (starting and ending) of the
line are entirely situated inside the window.
• Invisible Line: When both points (Starting and ending) of
the line are completely situated outside the window.
• Clipped Line: Everyline has two endpoints. Let (x0, y0) and
(x1, y1) are points of the line. If one point of the line situated
inside the window and the other one is outside the
window, then the line is known as Clipped Line.
Steps when using the Algorithm
1.Determine the region codes for the endpoints of
the line.
2.Check if both endpoints are within the clipping
window (region code = 0000). If they are, the
line is completely inside the window and can be
displayed.
3.If both endpoints have a region code that has a
common bit value of 1, the line is completely
outside the clipping window and can be rejected.
Step 4
• If the line is partially inside the clipping window, perform line
clipping using the following steps:
• a. Find the intersection of the line with the clipping window
boundaries.
• b. If an endpoint lies outside the clipping window, replace it
with the intersection point.
• c. Recalculate the region codes for the new endpoints.
• d. Repeat steps b and c until both endpoints lie within the
clipping window or the line is completely outside.
Example
In the below-mentioned example, we have
different lines. The different category of the line
Example
• Line AB is a clipped case.
• The line CD is completely visible.
• Line EF is completely invisible.
• Line GH is a clipped case.
• Line KL is completely invisible.
• Line IJ is a clipped case.
Endpoints of the Lines
• The endpoints of lines are lies as follow
• A ? 0000
• B ? 1010
• C ? 0000
• D ? 0000
• E ? 0100
• F ? 0100
• G ? 0001
• H ? 0000
• I ? 0000
• J ? 0010
• K ? 1000
• L ? 1000
Applications of the Algorithm
1. Line Clipping in Computer Graphics: The primary application
of the Cohen-Sutherland algorithm is in line clipping for
rendering graphics. It efficiently determines which portions of
a line lie inside or outside a given clipping window, allowing
for the rendering of only the visible parts of the line. This helps
optimize the rendering process and improve the overall
efficiency of graphics systems.
2. Window and Viewport Clipping: The Cohen-Sutherland
algorithm can be used for window and viewport clipping in
graphical user interfaces (GUIs). It determines which portions
of a window or viewport lie within the visible area, ensuring
that only the visible content is displayed. This is particularly
useful when working with large documents or images that
need to be displayed within a limited viewing area.
Applications
1. Line Clipping in CAD Systems: Computer-aided design (CAD)
systems often make use of the Cohen-Sutherland algorithm
for line clipping operations. It enables the efficient
manipulation and display of lines and geometries within the
CAD environment. The algorithm ensures that only the visible
portions of lines are displayed, allowing designers and
engineers to work with accurate and visually appealing
representations.
2. Image Processing and Digital Photography: In image
processing and digital photography applications, the Cohen-
Sutherland algorithm can be utilized for cropping or trimming
images. It allows for the precise selection of regions of
interest and removal of unwanted portions, resulting in
improved composition and visual aesthetics.
Advantages of the algorithm
• Ability to handle arbitrary clipping windows: The algorithm can handle
clipping windows of any shape, not just rectangular ones. This makes it
more flexible and versatile than other clipping algorithms that are
limited to rectangular windows.
• Efficiency in handling many different types of lines: The algorithm is
efficient in handling many different types of lines, including vertical,
horizontal, and diagonal lines. It can also handle lines of any slope,
including those that are steep or nearly horizontal.
• Easy to implement: The algorithm is relatively easy to implement and
can be adapted to a variety of programming languages and
environments.
Limitations
• Inability to handle curved lines: The algorithm is not capable of
handling curved lines, which can be a significant limitation in some
cases. Other algorithms, such as the Cyrus-Beck algorithm, can handle
curved lines but may not be as efficient as the Cohen-Sutherland
algorithm.
• Limited to line clipping: The Cohen-Sutherland algorithm is designed
specifically for line clipping and cannot be used for other types of
clipping, such as polygon clipping.
• Requires pre-processing: The algorithm requires pre-processing to
compute the two-bit codes for each point or line segment, which can
add some overhead to the overall clipping process.

More Related Content

Similar to Group 5 Presentation.pptx

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
 
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdfUNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
VivekKumar148171
 
Computer Aided Design visual realism notes
Computer Aided Design visual realism notesComputer Aided Design visual realism notes
Computer Aided Design visual realism notes
KushKumar293234
 
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
Mani Kanth
 

Similar to Group 5 Presentation.pptx (20)

Bhavesh window clipping slidshare
Bhavesh window clipping slidshareBhavesh window clipping slidshare
Bhavesh window clipping slidshare
 
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 algorithm
Cohen sutherland line clipping algorithmCohen sutherland line clipping algorithm
Cohen sutherland line clipping algorithm
 
kgv.pptx
kgv.pptxkgv.pptx
kgv.pptx
 
CAD
CAD CAD
CAD
 
lecture8 clipping
lecture8 clippinglecture8 clipping
lecture8 clipping
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
Hidden line removal algorithm
Hidden line removal algorithmHidden line removal algorithm
Hidden line removal algorithm
 
AUTOCAD SOFTWAE ppt
AUTOCAD  SOFTWAE pptAUTOCAD  SOFTWAE ppt
AUTOCAD SOFTWAE ppt
 
final Unit 1-1.pdf
final Unit 1-1.pdffinal Unit 1-1.pdf
final Unit 1-1.pdf
 
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdfUNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
 
Dot matrix display design using fpga
Dot matrix display design using fpgaDot matrix display design using fpga
Dot matrix display design using fpga
 
Computer Aided Design visual realism notes
Computer Aided Design visual realism notesComputer Aided Design visual realism notes
Computer Aided Design visual realism notes
 
Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )
 
ibuib.pptx
ibuib.pptxibuib.pptx
ibuib.pptx
 
Digital design of maxillary of rpd's
Digital design of maxillary of rpd'sDigital design of maxillary of rpd's
Digital design of maxillary of rpd's
 
Clipping
ClippingClipping
Clipping
 
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
 
Sutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithmsSutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithms
 
Auto cad ppt
Auto cad pptAuto cad ppt
Auto cad ppt
 

More from KelvinDube4 (7)

CLOUD_COMPUTING_PRESENTATION.pptx
CLOUD_COMPUTING_PRESENTATION.pptxCLOUD_COMPUTING_PRESENTATION.pptx
CLOUD_COMPUTING_PRESENTATION.pptx
 
introduction.pptx
introduction.pptxintroduction.pptx
introduction.pptx
 
boundary_security.pptx
boundary_security.pptxboundary_security.pptx
boundary_security.pptx
 
DATA COM PRESENTATION-1.pptx
DATA COM PRESENTATION-1.pptxDATA COM PRESENTATION-1.pptx
DATA COM PRESENTATION-1.pptx
 
Fundamental_Security_Design_Principles.pptx
Fundamental_Security_Design_Principles.pptxFundamental_Security_Design_Principles.pptx
Fundamental_Security_Design_Principles.pptx
 
Group 5 Presentation.pptx
Group 5 Presentation.pptxGroup 5 Presentation.pptx
Group 5 Presentation.pptx
 
Group 6 Presentation - Copy.pptx
Group 6 Presentation - Copy.pptxGroup 6 Presentation - Copy.pptx
Group 6 Presentation - Copy.pptx
 

Recently uploaded

reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdfreStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
Ken Fuller
 
Chikkabanavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Chikkabanavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Chikkabanavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Chikkabanavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
amitlee9823
 
Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........
deejay178
 
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Call Girls Bidadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Bidadi Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Bidadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Bidadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
Nagavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore Es...
Nagavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore Es...Nagavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore Es...
Nagavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore Es...
amitlee9823
 
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
amitlee9823
 
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men 🔝Tirupati🔝 Escor...
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men  🔝Tirupati🔝   Escor...➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men  🔝Tirupati🔝   Escor...
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men 🔝Tirupati🔝 Escor...
amitlee9823
 
➥🔝 7737669865 🔝▻ Mirzapur Call-girls in Women Seeking Men 🔝Mirzapur🔝 Escor...
➥🔝 7737669865 🔝▻ Mirzapur Call-girls in Women Seeking Men  🔝Mirzapur🔝   Escor...➥🔝 7737669865 🔝▻ Mirzapur Call-girls in Women Seeking Men  🔝Mirzapur🔝   Escor...
➥🔝 7737669865 🔝▻ Mirzapur Call-girls in Women Seeking Men 🔝Mirzapur🔝 Escor...
amitlee9823
 

Recently uploaded (20)

reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdfreStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
 
Chikkabanavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Chikkabanavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Chikkabanavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Chikkabanavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
 
Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........
 
Joshua Minker Brand Exploration Sports Broadcaster .pptx
Joshua Minker Brand Exploration Sports Broadcaster .pptxJoshua Minker Brand Exploration Sports Broadcaster .pptx
Joshua Minker Brand Exploration Sports Broadcaster .pptx
 
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls Bidadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Bidadi Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Bidadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Bidadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Brand Analysis for reggaeton artist Jahzel.
Brand Analysis for reggaeton artist Jahzel.Brand Analysis for reggaeton artist Jahzel.
Brand Analysis for reggaeton artist Jahzel.
 
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
 
Nagavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore Es...
Nagavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore Es...Nagavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore Es...
Nagavara Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore Es...
 
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
 
TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...
TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...
TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...
 
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Presentation for the country presentation
Presentation for the country presentationPresentation for the country presentation
Presentation for the country presentation
 
Personal Brand Exploration ppt.- Ronnie Jones
Personal Brand  Exploration ppt.- Ronnie JonesPersonal Brand  Exploration ppt.- Ronnie Jones
Personal Brand Exploration ppt.- Ronnie Jones
 
Solution Manual for First Course in Abstract Algebra A, 8th Edition by John B...
Solution Manual for First Course in Abstract Algebra A, 8th Edition by John B...Solution Manual for First Course in Abstract Algebra A, 8th Edition by John B...
Solution Manual for First Course in Abstract Algebra A, 8th Edition by John B...
 
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Personal Brand Exploration - Fernando Negron
Personal Brand Exploration - Fernando NegronPersonal Brand Exploration - Fernando Negron
Personal Brand Exploration - Fernando Negron
 
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men 🔝Tirupati🔝 Escor...
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men  🔝Tirupati🔝   Escor...➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men  🔝Tirupati🔝   Escor...
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men 🔝Tirupati🔝 Escor...
 
➥🔝 7737669865 🔝▻ Mirzapur Call-girls in Women Seeking Men 🔝Mirzapur🔝 Escor...
➥🔝 7737669865 🔝▻ Mirzapur Call-girls in Women Seeking Men  🔝Mirzapur🔝   Escor...➥🔝 7737669865 🔝▻ Mirzapur Call-girls in Women Seeking Men  🔝Mirzapur🔝   Escor...
➥🔝 7737669865 🔝▻ Mirzapur Call-girls in Women Seeking Men 🔝Mirzapur🔝 Escor...
 

Group 5 Presentation.pptx

  • 1. Group 6 Presentation Name Takudzwa Mutambu Ngonidzashe Mwendera Gerald Matanhire Devotion Masikati Tapiwanashe Gwena Shamiso Khumbula Kelvin Dube Assani Saidi Reg Number R192975T R197295X R1912448M R1915853W R1912331Z R1913840M R175251T R194565B
  • 2. Introduction • The line clipping is a process in which we can cut the part of the line, which lies outside the view pane. Only those lines are visible, which lie inside the view pane. • The Cohen-Sutherland line clipping algorithm is a common method used in computer graphics to efficiently clip lines against a rectangular clipping window. Line clipping is an important task in computer graphics because it allows us to selectively display only the portions of a line that are visible within a given viewport or window while discarding the portions that lie outside of it. This can improve the overall performance and visual quality of a graphics application, particularly when rendering complex scenes. • In this presentation, we will introduce the Cohen-Sutherland line clipping algorithm, explain how it works, demonstrate its use with an example, discuss its advantages and limitations.
  • 5. How the algorithm works • We will divide the view pane into nine equal segments that only serve the viewport. • We will represent the top, bottom, left, and right corner of the window with 4 bits. These 4 bits can be described with the following point: • If an object lies within any particular corner position, that corner value will be 1, else it will be 0. • The allocation of bits depends on “TBRL” (Top, Bottom, Right, Left) rule. • Suppose, if the point of a line appears in the top-left corner, then according to TBRL, the value is 1001. We will allot the bits as- • For the top corner, because the object is present at the top corner. • For the bottom corner, because the object does not lie at the bottom. • For the right corner, because the object does not lie at the right side. • For the left corner, because the object lies at the top-left corner. • In this way, we check TBRL for each segment and allot the bits accordingly.
  • 7. Line Viewing • In Cohen- Sutherland Algorithm we will divide the lines into following Sections • Visible Line: When both points (starting and ending) of the line are entirely situated inside the window. • Invisible Line: When both points (Starting and ending) of the line are completely situated outside the window. • Clipped Line: Everyline has two endpoints. Let (x0, y0) and (x1, y1) are points of the line. If one point of the line situated inside the window and the other one is outside the window, then the line is known as Clipped Line.
  • 8. Steps when using the Algorithm 1.Determine the region codes for the endpoints of the line. 2.Check if both endpoints are within the clipping window (region code = 0000). If they are, the line is completely inside the window and can be displayed. 3.If both endpoints have a region code that has a common bit value of 1, the line is completely outside the clipping window and can be rejected.
  • 9. Step 4 • If the line is partially inside the clipping window, perform line clipping using the following steps: • a. Find the intersection of the line with the clipping window boundaries. • b. If an endpoint lies outside the clipping window, replace it with the intersection point. • c. Recalculate the region codes for the new endpoints. • d. Repeat steps b and c until both endpoints lie within the clipping window or the line is completely outside.
  • 10. Example In the below-mentioned example, we have different lines. The different category of the line
  • 11. Example • Line AB is a clipped case. • The line CD is completely visible. • Line EF is completely invisible. • Line GH is a clipped case. • Line KL is completely invisible. • Line IJ is a clipped case.
  • 12. Endpoints of the Lines • The endpoints of lines are lies as follow • A ? 0000 • B ? 1010 • C ? 0000 • D ? 0000 • E ? 0100 • F ? 0100 • G ? 0001 • H ? 0000 • I ? 0000 • J ? 0010 • K ? 1000 • L ? 1000
  • 13. Applications of the Algorithm 1. Line Clipping in Computer Graphics: The primary application of the Cohen-Sutherland algorithm is in line clipping for rendering graphics. It efficiently determines which portions of a line lie inside or outside a given clipping window, allowing for the rendering of only the visible parts of the line. This helps optimize the rendering process and improve the overall efficiency of graphics systems. 2. Window and Viewport Clipping: The Cohen-Sutherland algorithm can be used for window and viewport clipping in graphical user interfaces (GUIs). It determines which portions of a window or viewport lie within the visible area, ensuring that only the visible content is displayed. This is particularly useful when working with large documents or images that need to be displayed within a limited viewing area.
  • 14. Applications 1. Line Clipping in CAD Systems: Computer-aided design (CAD) systems often make use of the Cohen-Sutherland algorithm for line clipping operations. It enables the efficient manipulation and display of lines and geometries within the CAD environment. The algorithm ensures that only the visible portions of lines are displayed, allowing designers and engineers to work with accurate and visually appealing representations. 2. Image Processing and Digital Photography: In image processing and digital photography applications, the Cohen- Sutherland algorithm can be utilized for cropping or trimming images. It allows for the precise selection of regions of interest and removal of unwanted portions, resulting in improved composition and visual aesthetics.
  • 15. Advantages of the algorithm • Ability to handle arbitrary clipping windows: The algorithm can handle clipping windows of any shape, not just rectangular ones. This makes it more flexible and versatile than other clipping algorithms that are limited to rectangular windows. • Efficiency in handling many different types of lines: The algorithm is efficient in handling many different types of lines, including vertical, horizontal, and diagonal lines. It can also handle lines of any slope, including those that are steep or nearly horizontal. • Easy to implement: The algorithm is relatively easy to implement and can be adapted to a variety of programming languages and environments.
  • 16. Limitations • Inability to handle curved lines: The algorithm is not capable of handling curved lines, which can be a significant limitation in some cases. Other algorithms, such as the Cyrus-Beck algorithm, can handle curved lines but may not be as efficient as the Cohen-Sutherland algorithm. • Limited to line clipping: The Cohen-Sutherland algorithm is designed specifically for line clipping and cannot be used for other types of clipping, such as polygon clipping. • Requires pre-processing: The algorithm requires pre-processing to compute the two-bit codes for each point or line segment, which can add some overhead to the overall clipping process.