Liang Barsky line clipping algorithm -
The parametric equation for Liang Barsky line clipping algorithm is given as,
From above definitions of p and q we can say that,
The parameter t for any clipping boundary i can be given as,
Liang - Barsky algorithm calculates two values of parameter t : t1 and t2. The value of
t1 is determined by checking the rectangle edges for p < 0. The maximum value is
taken as a value for t1. The value of t2 is determined by checking the rectangle edges
for p > 0. The minimum value is taken as a value for t2.