Liang–Barsky algorithm: Difference between revisions

Content deleted Content added
The if condition that checks if the line is parallel to the clipping window was incomplete. The correct condition is "if((p1==0 && q1 < 0) || (p3 ==0 && q3 < 0))" to check if the line is parallel AND outside the clipping window.
Correction of code: Should be: float r4 = q4/p4; It was: float r4 = q4/r4;
Line 109:
{
float r3 = q3/p3;
float r4 = q4/r4p4;
 
if(p3<0)