Cyrus–Beck algorithm

From testwiki
Jump to navigation Jump to search

Template:Short description

Cyrus–Beck algorithm

In computer graphics, the Cyrus–Beck algorithm is a generalized algorithm for line clipping. 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 Cohen-Sutherland, which can be used only on a rectangular clipping area.

Here the parametric equation of a line in the view plane is 𝐩(t)=t𝐩1+(1t)𝐩0 where 0t1.

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

Calculate 𝐧(𝐩(t)𝐩E):

  • if < 0, vector pointed towards interior;
  • if = 0, vector pointed parallel to plane containing Template:Tmath;
  • if > 0, vector pointed away from interior.

Here Template:Tmath 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

Template:Reflist

See also

Algorithms used for the same purpose:

References in other media:

References


Template:Compu-graphics-stub