Contents
What is the disadvantage of Cohen-Sutherland line clipping?
. Clipping windows region can be rectangular in shape only and no other polygonal shaped window is allowed. . Causes jaggiews or stair step effect.
What is the disadvantage of Liang-Barsky algorithm to Cohen-Sutherland line clipping algorithm?
The major disadvantage of this algorithm is that it can only be applied to two-dimensional clipping (Huang, 2010). On the other hand, the Liang-Barsky and the Cohen-Sutherland methods are easily extended to three- dimensional scenes (Huang, 2010).
Which is better Liang-Barsky or Cohen-Sutherland line clipping algorithm?
Liang-Barsky algorithm is intersection calculations can be reduced, so more efficient than the Cohen-Sutherland algorithm. In contrast, the Cohen-Sutherland algorithm can repeatedly calculate intersections along a line path, even though the line may be completely outside the clip window.
How do you solve Cohen-Sutherland problem?
Clip a line A (-1,5) and B (3,8) using the Cohen Sutherland algorithm with window coordinates (-3,1) and (2,6). Here xmin =-3 and ymin=1 with xmax =1 and ymax=6 with x1=-1, y1=5 and x2=3, y2=8. – Bit 1 = Sign of (y-ymax) = Sign of (5-6) = Negative, so bit 1 would be 0.
Which is better line clipping algorithm?
The Liang-Barsky algorithm is a line clipping algorithm. This algorithm is more efficient than Cohen–Sutherland line clipping algorithm and can be extended to 3-Dimensional clipping. This algorithm is considered to be the faster parametric line-clipping algorithm.
How to find the point where a line needs to be clipped?
– Needs Clipping: The line would be clipped if bit wise AND Product of code is zero. – Find the point where the boundary line cuts the given line. – If Bit-1 is 1 then the line cuts the y=ymax. – If Bit-2 is 1 then the line y=ymin. – If Bit-3 is 1 then the line x=xmax. – If Bit-4 is 1 then the line x=xmin.
How to clip a line against a window?
Objective: The line to be clipped against the window. This means clip the line segment which is not visible in the window. Assumptions: x1,y1, and x2,y2 be the starting and endpoints of the line. Xmin, ymin and xmax,ymax be the starting and ending points of the window.
How to clip a line with a region code 0000?
Step 1 : Assign a region code for two endpoints of given line. Step 2 : If both endpoints have a region code 0000 then given line is completely inside. Step 3 : Else, perform the logical AND operation for both region codes. Step 3.1 : If the result is not 0000, then given line is completely outside. Step 3.2 : Else line is partially inside.