<p>The outcodes just represent four boolean flags as a bitfield. Codewise it is easier to move a bitfield around than four booleans. Functionality-wise it becomes very easy to check if <em>any</em> bits are set (just check if zero), and combining outcodes is as simple as a bitwise OR.</p>

<p>On a side-note: Since bit-operations are fast, it is not a performance issue that the individual bits need to be extracted (e.g. outcode &amp; BOTTOM).</p>

CC BY-SA 3.0
2016-01-18T11:58:50.560Z
2016-01-18T11:58:50.560Z
Mikkel Gjoel
<p>What advantages do the outcodes offer in <a href="https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm" rel="nofollow">this algorithm</a> ? Do they help in simplifying the algorithm ? Do they decrease the number of calculations ?</p>

CC BY-SA 3.0
2016-01-18T09:10:28.977Z
Your question could probably be improved by including some more information about the actual algorithm instead of just linking to it. Posts should generally be self-contained so as not to be susceptible to link rot (even though that's unlikely for Wikipedia) and so that people can understand the full question without having to read an external link first.
Martin Ender
<clipping>
Outcodes in Cohen-Sutherland Clipping Algorithm
john john
# Outcodes in Cohen-Sutherland Clipping Algorithm

(Asked by: username_0 on 2016-01-15)

What advantages do the outcodes offer in [this algorithm](https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm) ? Do they help in simplifying the algorithm ? Do they decrease the number of calculations ?

**Tags:** clipping

> **Comments:**
> **username_1**: Your question could probably be improved by including some more information about the actual algorithm instead of just linking to it. Posts should generally be self-contained so as not to be susceptible to link rot (even though that's unlikely for Wikipedia) and so that people can understand the full question without having to read an external link first.  

---

## 1 answers

### Answer by username_2 on 2016-01-18. Score: 3

The outcodes just represent four boolean flags as a bitfield. Codewise it is easier to move a bitfield around than four booleans. Functionality-wise it becomes very easy to check if *any* bits are set (just check if zero), and combining outcodes is as simple as a bitwise OR.

On a side-note: Since bit-operations are fast, it is not a performance issue that the individual bits need to be extracted (e.g. outcode & BOTTOM).


---

