Steps for clip a line segment-PQ
- Initially, find all the points of intersections of the line segment PQ along with the edges of the polygonal window and describe them either as P_{E} and P_{L} points. Also find out the value of parameter t, by using equation (2) for respective PE's and PL's.
Or
If value of the normal to particular edges is not specified then, determine the value of normal to every edge of the window, then find out the value of parameter t, by using equation (2) for particular point of intersection among line segment and window edge then on the basis of the value of parameter t mark them like P_{E} and P_{L} given the value of t lies from 0 to 1 in magnitude.
- Secondly, out of the diverse values of t for P_{E}'s find out the maximum value of t say it is t_{max}. Likewise, out of the diverse values of t for P_{L}'s find out the minimum value of t say it be t_{min} . Remember here that for clipping to be possible t_{min} > t_{max}.
- at last, vary the parameter t from t_{max} to t_{min} and find out the clipped line as outcome.
For well understanding of steps here figure is shown below:
Figure: Steps of Cyrus Beck Clipping
During in case of Line 1: (PQ)
1) Point 1 is potentially entering (P_{E1}) since as we move along PQ, the LHS of e_{1} is window and hence, it seems that we are entering the window.
2) Point 2 is again P_{E2} same as point 1.
3) Point 3 is potentially leaving (P_{4}) ? as we move along PQ, the LHS of e_{2} is window and hence, it seems that we are leaving the window.
4) As the same, point 4 is also P_{L2}.
Line 2 and 3 (PQ):
By using similar logic as for line 1 we determine p‾_{L} and PE. Here, it is to be noted that for all points of intersection we have several value of t.
Say t_{1} is value of t for P_{E1}
Say t_{2} is value of t for P_{E2}
Say t_{3} is value of t for P_{L1}
Say t_{4} is value of t for P_{L2}