LIANG BARSKY LINE CLIPPING ALGORITHM PDF
2 types of line clipping algorithm with example. Cohen-Sutherland Line Clipping and Liang-Barsky Line Clipping Algorithm By Shilpa. Liang-Barsky line clipping algorithm. ▫ Sutherland-Hogeman polygon clipping. 3. Pedher Johansson. Department of Computing Science, Umeå University. Liang – Barsky line clipping algorithm is faster line clipper algorithm based on analysis of the parametric equation of a line segment. Parametric equation of line .
|Published (Last):||22 April 2007|
|PDF File Size:||10.8 Mb|
|ePub File Size:||16.4 Mb|
|Price:||Free* [*Free Regsitration Required]|
The Liang-Barsky line clipping algorithm in a lianng At Skytopia, we pride ourselves in making some of the most difficult concepts as easy to understand as possible. Well, we’ve outdone ourselves again, and present you with the easiest tutorial to the Liang Barsky line clipping algorithm on the whole net!
Example of Liang-Barsky Line Clipping
It was created after I went through torture trying to research it liagn for my uni course. We hope you agree that the colour coding, examples, numerous diagrams pixel-precise and to scale!
Diagram 1 GOAL – Clip line to the inside of the lighter blue area To begin with, we assume that we want to draw the whole line. In reality of course, this would only apply if the line was fully inside the lighter blue area.
But bear with me, since the following algorithm will gradually clip it down, clpiping by edge. So the beginning of the line P 0 will be represented by 0and the end of the line P 1 by 1.
We can store these values in variables, as we will need to adjust them as the algorithm progresses. We need to find out some values before we proceed. These two Xdelta and Ydelta are the most frequently used throughout the whole algorithm, so get ilang stuck into your brain: Okay, now we’re ready to start.
Liang–Barsky algorithm – Wikipedia
What we’ll do is go through each edge border in turn Left, Right, Bottom, Topand at each stage we will either tweak t0 or t1, or we may find out that algotithm line is outside the border algorjthm, and therefore doesn’t need drawing – in which case we clippjng cut the algorithm there and then! Anyway, we start with a Diagram 1b Left edge check: More values need calculating for our first check: Anyway, if this is the case which it is for uswe do this check: Thus we would scrap everything don’t draw the line!
Now go to next edge. Otherwise, skip to next edge. If P is more than zero however which it isn’t in this example btw – we’ve already had the above executed, so the below boxout is only for future edge checks! Diagram 1b Just for reference, remember that: Do the same for the other edges!
Now you’ve practically understood the whole algorithm because we can generalize what we’ve done for the left edge, to the other edges! There are slight differences though.
Clipping: Liang-Barsky Line Clipping
We use slightly different values for P and Q R remains the same though: Also remember to take the new values for t0 and t1 into account the instructions above assume we’re starting out, and therefore think that t0 still equals 0 barsoy t1 still equals 1, when that’ll change as we check each edge in turn.
It basically avoids any unnecessary calculations if the line was already completely inside the edges to start with: Amount you wish to contribute: White onwards other than the code which you can freely use. Amount you wish to contribute:.