Cyrus–Beck algorithm

The Cyrus–Beck algorithm is a generalized line clipping algorithm. It was designed to be more efficient than the Cohen–Sutherland algorithm, which uses repetitive clipping.[1] Cyrus–Beck is a general algorithm and can be used with a convex polygon clipping window, unlike Sutherland–Cohen, which can be used only on a rectangular clipping area.

Cyrus–Beck algorithm

Here the parametric equation of a line in the view plane is

where .

Now to find the intersection point with the clipping window, we calculate the value of the dot product. Let pE be a point on the clipping plane E.

Calculate :

if < 0, vector pointed towards interior;
if = 0, vector pointed parallel to plane containing p;
if > 0, vector pointed away from interior.

Here n stands for normal of the current clipping plane (pointed away from interior).

By this we select the point of intersection of line and clipping window where (dot product is 0) and hence clip the line.

Notes

gollark: Anyway, if they say it's a mess inside they are probably concerned about code quality and not what it looks like.
gollark: Why's the GPU use one about 75% full even though utilisation is 1.5%?
gollark: The circle graph things don't make sense.
gollark: Yes. Memorising things takes a while. Consider spaced repetition.
gollark: I'm pretty sure it already has to significant extents.

See also

Algorithms used for the same purpose:

References in other media:

References


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.