<p>Maybe it helps to draw out the steps of the algorithm. Here is an example for TBLR 
<a href="https://i.sstatic.net/bNJzf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bNJzf.png" alt="enter image description here"></a></p>

<p>The red is the worst case: clip top, clip bottom, clip left, clip right. Four steps!</p>

<p>The green is the best case: clip top, clip bottom, done. Two steps.</p>

<p>The blue is a middle case: clip top, clip bottom, clip left, done. Three steps.</p>

CC BY-SA 3.0
2017-05-10T13:45:00.500Z
2017-05-10T13:45:00.500Z
user81327
<p>I'm currently enrolled in an entry level Computer Graphics class, and as I'm studying for my final, I realize I have a question regarding the Cohen-Sutherland line clipping algorithm. I understand the basics of the algorithm, such as how to compute the 4-bit outcodes associated with each region and the test conditions for the endpoints of a line segment, but where I'm struggling is how to determine what the worst case scenario is for the algorithm.</p>

<p><strong>I've had the following question on both my midterm and a homework assignment: "Draw two line segments (one with a positive slope and one with a negative slope) that reflect the worst case scenarios for the corresponding checking order."</strong> </p>

<p>The following image file shows what the checking order was for each question, along with my original answers to the questions followed by the correct answers. If anyone could point me in the right direction, it would be greatly appreciated. The only "answer" from my professor I received when asking for an explanation was "the worst case has to do with the checking order", and that answers absolutely nothing for me.
<a href="https://i.sstatic.net/212kU.png" rel="noreferrer"><img src="https://i.sstatic.net/212kU.png" alt="enter image description here"></a></p>

<clipping>
Worst Case Scenario for Cohen-Sutherland Line Clipping Algorithm
user3263736
# Worst Case Scenario for Cohen-Sutherland Line Clipping Algorithm

(Asked by: username_0 on 2017-05-07)

I'm currently enrolled in an entry level Computer Graphics class, and as I'm studying for my final, I realize I have a question regarding the Cohen-Sutherland line clipping algorithm. I understand the basics of the algorithm, such as how to compute the 4-bit outcodes associated with each region and the test conditions for the endpoints of a line segment, but where I'm struggling is how to determine what the worst case scenario is for the algorithm.

**I've had the following question on both my midterm and a homework assignment: "Draw two line segments (one with a positive slope and one with a negative slope) that reflect the worst case scenarios for the corresponding checking order."**

The following image file shows what the checking order was for each question, along with my original answers to the questions followed by the correct answers. If anyone could point me in the right direction, it would be greatly appreciated. The only "answer" from my professor I received when asking for an explanation was "the worst case has to do with the checking order", and that answers absolutely nothing for me.
[![enter image description here](https://i.sstatic.net/212kU.png)](https://i.sstatic.net/212kU.png)

**Tags:** clipping


---

## 1 answers

### Answer by username_1 on 2017-05-10. Score: 3

Maybe it helps to draw out the steps of the algorithm. Here is an example for TBLR
[![enter image description here](https://i.sstatic.net/bNJzf.png)](https://i.sstatic.net/bNJzf.png)

The red is the worst case: clip top, clip bottom, clip left, clip right. Four steps!

The green is the best case: clip top, clip bottom, done. Two steps.

The blue is a middle case: clip top, clip bottom, clip left, done. Three steps.


---

