- For given window with (XWmin, YWmin) and (XWmax, YWmax), the given line has end-points (X1, Y1) and (X2, Y2).
- Calculate
- Calculate pk, qk and rk for k = 1, 2, 3, 4 as:
- If pk=0 for some k, then the line is parallel to clipping boundary. Now test qk:
If all qk ≥ 0 for these k, then some portion of the line is inside.
- For all pk < 0 (i.e. line proceeds from outside to inside the boundary), calculate to determine intersection point with the possibly extended clipping boundary k and obtain a new starting point for the line at u1.
- For all pk > 0 (i.e. line proceeds from inside to outside the boundary), calculate to determine intersection point with the possibly extended clipping boundary k and obtain a new end point for the line at u2.
- If discard the line.
- Else, the line is now between
- Hence,
- Updated points are
No comments:
Post a Comment