1) Read end points of line P1 and P2.

2) Read vertex coordinates of clipping window.

3) Calculate D = P2 – P1

4) Assign boundary point b with particular edge

5) Find inner normal vector for corresponding edge.

6) Calculate D.n and W = P1 – b

7) If D.n > 0,

tL = – (W.n)/(D.n)

else

tU = – (W.n)/(D.n)

end if

8) Repeat steps 4 through 7 for each edge of clipping window.

9) Find maximum lower limit and minimum upper limit.

10) If maximum lower limit and minimum upper limit do not satisfy condition 0 ≤ t ≤ 1 then ignore line

11) Calculate intersection points by substituting values of maximum lower limit and minimum upper limit in parametric equation of line P1P2.

12) Draw line segment P(tL) to P(tU)

13) Stop.

Ayşe says

thank you

Ayşe says

at the end tU must be greather than tL, otherwise line should be ignored.