Liang–Barsky algorithm: Difference between revisions

Content deleted Content added
Added a page in "External Links" that greatly helped me in understanding this concept.
Correction of code: The condition of #5: "If u1 > u2, the line is outside and therefore rejected" was missing. Suggestion: rename 'rn1' to 'u1' and 'rn2' to 'u2'?
Line 107:
rn1 = maxi(negarr, negind); // maximum of negative array
rn2 = mini(posarr, posind); // minimum of positive array
 
if (rn1 > rn2) { // reject
outtextxy(80, 80, "Line is outside the clipping window!");
return;
}
 
xn1 = x1 + p2 * rn1;