× Close
Join the Ques10 Community
Ques10 is a community of thousands of students, teachers, and academic experts, just like you.
Join them; it only takes a minute
Sign up
Question: Explain Liang-Barsky line clipping algorithm with example. OR Write a line clipping algorithm which uses parametric form of equation.
0

Subject: Computer Graphics

Topic: Two Dimensional Viewing and Clipping

Difficulty: High

cg(14) • 2.0k views
ADD COMMENTlink
modified 8 months ago  • written 10 months ago by gravatar for vbadbe vbadbe60
0

Liang-Barsky line clipping algorithm:-

Liang and Barsky have developed more efficient algorithm than Cyrus-Beck algorithm, using parametric equations and is also efficient than Cohen-Sutherland algorithm . The parametric equations are given as,

enter image description here

The point clipping conditions for Liang-Barsky approach in the parametric form can be given as

enter image description here

Liang-Barsky expresses these four inequalities with two parameters p and q as follows:

enter image description here

where parameters p and q are defined as

enter image description here enter image description here enter image description here

Liang-Barsky algorithm calculates two values of Parameter t : t1 and t2 that define that part of the line that lies within the clip rectangle. The value of t1 is determined by checking the rectangle edges for which the line proceeds from the outside to the inside (p <0). The value of t1 is taken as a largest value amongst various values of intersections with all edges. On the other hand, the value of t2 is determined by checking the rectangle edges for which the line proceeds from the inside to the outside (p > 0). The minimum of the calculated value is taken as a value for t2.

Now, if t1 > t2, the line is completely outside the clipping window and it can be rejected. Otherwise the values of t1 and t2 are substituted in the parametric equations to get the end points of the clipped line.

enter image description here enter image description here enter image description here

ADD COMMENTlink
written 8 months ago by gravatar for vbadbe vbadbe60
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.