Liang b arsky line clipping algorithm, Computer Graphics

Assignment Help:

Write the Liang B arsky line clipping algorithm. Why is Liang Barsky algorithm more efficient than the Cohen Sutherland algorithm? 

Liang Barsky Line Clipping: Faster line clippers have been developed that are based an analysis of the parametric equation of a line segment, Which we can write in the form: where using these parametric equation Cyrus and Beck developed an alga that is generally more efficient than the Cohen Sutherland alga. Later Liang and Barsky independently devised an even faster parametric line clipping alga. In this first write the paint clipping conditions in the parametric form: each of these four inequalities can be expressed as: where parameters p and q are defined.  Any line that is parallel to one of the clipping boundaries has pk­ = 0 for the value of k corresponding to that boundaries ( k = 1, 2, 3, and 4 correspond to the left, right, bottom and top boundaries ) If for the value of k we also find qk < 0, then line is completely outside the boundary and can be eliminated from further consideration. If qk > 0, the infinite extension of the line processed from the outside to the inside of the infinite extension of this particular clipping boundary. If pk > 0 the line proceeds from the inside to the outside. For a nonzero value of p k, we can calculate the value of u that corresponds to the point where the infinitely extended line intersects the extension of boundary k.  For each line, we can calculate values for parameters u­1 and u2 that define that part of the line that lies within the clip rectangle. The value of r is determined by looking at the rectangle edges for which the line proceeds from the outside to the inside . For these edges we calculate. The value of as taken as the largest of the set consisting of 0 and the various values of r. Conversely the value of is determined by examining the boundaries for which the line proceeds from inside to outside. A value of r is calculated for each of these boundaries, and the value of is the minimum of the set consisting of 1 and the calculated r values. If u1 > u2 the line is completely outside the clip window and of can be rejected. Otherwise the endpoints of the clipped line are calculated from the two values of parameter u.  This algorithm is presented in the following procedure, Line intersection parameters are initialized to the values u1 = 0 and u2 = 1. For each clipping boundary the appropriate values for p and q are calculated and rsed by the function clip test to determine whether the line can be rejected of whether the intersection parameters are to be adjusted. When p > 0, the parameter r is used to update  u1; when p > 0 parameter r is used to update u. If updating u­1 or u2 results in u1 > u2 we reject the line. Otherwise we update the appropriate u parameter only if the new value results in a shortening of the line. When p = 0 and q < 0 we can discard the line since it is parallel to and outside of this boundary If the line has not been rejected after all four values of p and q have been tested, the endpoints of the clipped line are determined from values of u1 and u­­2.

Efficiency of Liang Algorithm than Cohen Sutherland algorithm: The Liang-Barky  algorithm is more efficient than the Cohen Sutherland algorithm, since intersection calculations are reduced. Each update of parameters u and u requires only one division; and window intersections of the line are computed only once, when the final values of u and u have been computed. 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. And each intersection calculation requires both a division and a multiplication. Both the Cohen Sutherland and the Liang Barky algorithms can be extended to three dimensional clipping. 


Related Discussions:- Liang b arsky line clipping algorithm

Important points about the illumination model, Important points about the i...

Important points about the illumination Model An illumination model is also termed as lighting model and sometimes considered to as shading model, that is utilized to compute

Orientation dependence - modeling and rendering, Orientation Dependence - M...

Orientation Dependence - Modeling and Rendering The outcomes of interpolated-shading models are dependent of the projected polygon's orientation. Because values are interpolat

Pitfalls in computer simulation - computer aided design, Pitfalls in comput...

Pitfalls in computer simulation Though generally avoided in computer simulations, in strict logic the rules governing floating point arithmetic even apply. For illustration, t

What is the need of homogeneous coordinates, What is the need of homogeneou...

What is the need of homogeneous coordinates?  To perform more than one transformation at a time, use homogeneous coordinates or matrixes. They decrease unwanted calculations in

Write a c code for generating concentric circles, Write a C code for genera...

Write a C code for generating concentric circles.  Put the circle function circleMidpoint()in a for loop  as follows: for( int radius = MinRadius; radius circleMidpoint(i

Do we have need of to generate full circumference of circle, 1.   Do we hav...

1.   Do we have need of to generate the full circumference of the circle utilizing the algorithm or  can we can produces it in a quadrant or octant only and after that utilization

Audio file formats, Audio File Formats: It is a container format for ...

Audio File Formats: It is a container format for storing audio data in a computer system. Many file formats are there for storing audio files. The common approach towards

Resolution-introduction to computer graphics, Resolution Graphic demons...

Resolution Graphic demonstrations are utilized in presentations to assist convey a concept or express a mood, two kinds of demonstrations graphics are: Vector, and B

Two kinds of video tele conference systems, There are mostly two kinds of V...

There are mostly two kinds of Video Tele Conference systems: 1) Desktop systems are add-ons to normal PC's, transforming them in Video Tele Conference devices. A range of variou

Definition of computer animation, Definition of Computer Animation A ti...

Definition of Computer Animation A time dependence phenomenon for imparting visual modifies in any scene as per to any time sequence, the visual modifies could be incorporated

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd