<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.formulasearchengine.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=84.3.71.228</id>
	<title>formulasearchengine - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://en.formulasearchengine.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=84.3.71.228"/>
	<link rel="alternate" type="text/html" href="https://en.formulasearchengine.com/wiki/Special:Contributions/84.3.71.228"/>
	<updated>2026-08-20T09:09:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.47.0-wmf.7</generator>
	<entry>
		<id>https://en.formulasearchengine.com/w/index.php?title=Net_migration_rate&amp;diff=9650</id>
		<title>Net migration rate</title>
		<link rel="alternate" type="text/html" href="https://en.formulasearchengine.com/w/index.php?title=Net_migration_rate&amp;diff=9650"/>
		<updated>2013-12-01T22:10:30Z</updated>

		<summary type="html">&lt;p&gt;84.3.71.228: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[computer graphics]], the &#039;&#039;&#039;Liang–Barsky algorithm&#039;&#039;&#039; (named after [[You-Dong Liang]] and [[Brian A. Barsky]]) is a [[line clipping]] algorithm. The Liang–Barsky algorithm uses the parametric equation of a line and inequalities describing the range of the clipping window to determine the intersections between the line and the clipping window. With these intersections it knows which portion of the line should be drawn. This algorithm is significantly more efficient than [[Cohen–Sutherland]].&lt;br /&gt;
&lt;br /&gt;
The idea of the Liang-Barsky clipping algorithm is to do as much testing as possible before computing line intersections. &lt;br /&gt;
Consider first the usual parametric form of a straight line:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = x_0 + u (x_1 - x_0) = x_0 + u \Delta x\,\!&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y = y_0 + u (y_1 - y_0) = y_0 + u \Delta y\,\!&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A point is in the clip window, if&lt;br /&gt;
:&amp;lt;math&amp;gt;x_{\text{min}} \le x_0 + u \Delta x \le x_{\text{max}}\,\!&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
:&amp;lt;math&amp;gt;y_{\text{min}} \le y_0 + u \Delta y \le y_{\text{max}}\,\!&amp;lt;/math&amp;gt;,&lt;br /&gt;
which can be expressed as the 4 inequalities&lt;br /&gt;
:&amp;lt;math&amp;gt;u p_k \le q_k, \quad k = 1, 2, 3, 4\,\!&amp;lt;/math&amp;gt;,&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;p_1 = -\Delta x  ,               q_1 = x_0 - x_{\text{min}}\,\!&amp;lt;/math&amp;gt; (left)&lt;br /&gt;
:&amp;lt;math&amp;gt;p_2 = \Delta x  ,                q_2 = x_{\text{max}} - x_0\,\!&amp;lt;/math&amp;gt; (right)&lt;br /&gt;
:&amp;lt;math&amp;gt;p_3 = -\Delta y  ,               q_3 = y_0 - y_\text{min}\,\!&amp;lt;/math&amp;gt; (bottom)&lt;br /&gt;
:&amp;lt;math&amp;gt;p_4 = \Delta y   ,               q_4 = y_\text{max} - y_0\,\!&amp;lt;/math&amp;gt; (top)&lt;br /&gt;
&lt;br /&gt;
To compute the final line segment:&lt;br /&gt;
# A line parallel to a clipping window edge has &amp;lt;math&amp;gt;p_k = 0&amp;lt;/math&amp;gt; for that boundary.&lt;br /&gt;
# If for that &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;q_k &amp;lt; 0&amp;lt;/math&amp;gt;, the line is completely outside and can be eliminated.&lt;br /&gt;
# When &amp;lt;math&amp;gt;p_k &amp;lt; 0&amp;lt;/math&amp;gt; the line proceeds outside to inside the clip window and when &amp;lt;math&amp;gt;p_k &amp;gt; 0&amp;lt;/math&amp;gt;, the line proceeds inside to outside.&lt;br /&gt;
# For nonzero &amp;lt;math&amp;gt;p_k&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;u = \frac{q_k}{p_k}&amp;lt;/math&amp;gt; gives the intersection point.&lt;br /&gt;
# For each line, calculate &amp;lt;math&amp;gt;u_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;u_2&amp;lt;/math&amp;gt;. For &amp;lt;math&amp;gt;u_1&amp;lt;/math&amp;gt;, look at boundaries for which &amp;lt;math&amp;gt;p_k &amp;lt; 0&amp;lt;/math&amp;gt; (outside -&amp;gt; in). Take &amp;lt;math&amp;gt;u_1&amp;lt;/math&amp;gt; to be the largest among &amp;lt;math&amp;gt;\left(0,\frac{q_k}{p_k}\right)&amp;lt;/math&amp;gt;. For &amp;lt;math&amp;gt;u_2&amp;lt;/math&amp;gt;, look at boundaries for which &amp;lt;math&amp;gt;p_k &amp;gt; 0&amp;lt;/math&amp;gt; (inside -&amp;gt; out). Take &amp;lt;math&amp;gt;u_2&amp;lt;/math&amp;gt; to be the minimum of &amp;lt;math&amp;gt;\left(1, \frac{q_k}{p_k}\right)&amp;lt;/math&amp;gt;. If &amp;lt;math&amp;gt;u_1 &amp;gt; u_2&amp;lt;/math&amp;gt;, the line is outside and therefore rejected.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
Algorithms used for the same purpose:&lt;br /&gt;
* [[Cyrus–Beck]]&lt;br /&gt;
* [[Nicholl–Lee–Nicholl]]&lt;br /&gt;
* [[Fast-clipping]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
* Liang, Y.D., and Barsky, B., &amp;quot;A New Concept and Method for Line Clipping&amp;quot;, &#039;&#039;ACM Transactions on Graphics&#039;&#039;, 3(1):1-22, January 1984.&lt;br /&gt;
* Liang, Y.D., B.A., Barsky, and M. Slater, &#039;&#039;Some Improvements to a Parametric Line Clipping Algorithm&#039;&#039;, CSD-92-688, Computer Science Division, University of California, Berkeley, 1992.&lt;br /&gt;
* James D. Foley. &#039;&#039;[http://books.google.com/books/about/Computer_graphics.html?id=-4ngT05gmAQC Computer graphics: principles and practice]&#039;&#039;. Addison-Wesley Professional, 1996. p.&amp;amp;nbsp;117.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* http://hinjang.com/articles/04.html&lt;br /&gt;
&lt;br /&gt;
{{DEFAULTSORT:Liang-Barsky algorithm}}&lt;br /&gt;
[[Category:Clipping (computer graphics)]]&lt;/div&gt;</summary>
		<author><name>84.3.71.228</name></author>
	</entry>
</feed>