﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Keith Hair &#187; Line</title>
	<atom:link href="http://keith-hair.net/blog/tag/line/feed/" rel="self" type="application/rss+xml" />
	<link>http://keith-hair.net/blog</link>
	<description>Scripting is fun like any other hobby</description>
	<lastBuildDate>Sat, 28 Jan 2012 05:04:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Knowing if a Point is behind a Line</title>
		<link>http://keith-hair.net/blog/2009/05/27/knowing-if-a-point-is-behind-a-line/</link>
		<comments>http://keith-hair.net/blog/2009/05/27/knowing-if-a-point-is-behind-a-line/#comments</comments>
		<pubDate>Wed, 27 May 2009 21:15:01 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[SciFi]]></category>
		<category><![CDATA[Behind]]></category>
		<category><![CDATA[Line]]></category>
		<category><![CDATA[Points]]></category>
		<category><![CDATA[Test]]></category>

		<guid isPermaLink="false">http://keith-hair.net/blog/?p=58</guid>
		<description><![CDATA[Yea yea, I know Battlestar Galactica is over, but today I thought of the "Daybreak part 1" episode of BSG. Hera, a little girl has been kidnapped by the Cylons. As part of a desperate plan to save Hera, Admiral Adama draws a red line on the deck, and asks for those willing to risk [...]]]></description>
			<content:encoded><![CDATA[<p>Yea yea, I know Battlestar Galactica is over, but today I thought of the <a href="http://www.scifi.com/battlestar/episodes/episodes.php?seas=4&#038;ep=421&#038;act=3">"Daybreak part 1" episode of BSG</a>.<br />
Hera, a little girl has been kidnapped by the Cylons. As part of a desperate plan to save Hera, Admiral Adama draws a red line on the deck, and asks for those willing to risk their lives to save her, do so by crossing the line.</p>
<p>I had a similar problem also with my scripts. I wanted to simply know if a Point was behind a Line or not... <img src='http://keith-hair.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_behind_line_258364978"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="/blog/examples/intersections/behind_line.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/blog/examples/intersections/behind_line.swf"
			name="fm_behind_line_258364978"
			width="550"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><span id="more-58"></span></p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">/*-----------------------------------------------------------------
Returns true if Point P is behind line defined by Points C and D.
 ----------------------------------------------------------------*/</span>
<span style="color: #000000; font-weight: bold;">function</span> isBehindLine<span style="color: #66cc66;">&#40;</span>P:Point,C:Point,D:Point<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Boolean</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> a:<span style="color: #0066CC;">Number</span>=Point.<span style="color: #006600;">distance</span><span style="color: #66cc66;">&#40;</span>P,C.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>Point.<span style="color: #006600;">polar</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>,<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">atan2</span><span style="color: #66cc66;">&#40;</span>C.<span style="color: #006600;">y</span> - D.<span style="color: #006600;">y</span>,C.<span style="color: #006600;">x</span> - D.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> / <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> b:<span style="color: #0066CC;">Number</span>=Point.<span style="color: #006600;">distance</span><span style="color: #66cc66;">&#40;</span>P,C.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>Point.<span style="color: #006600;">polar</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">-1</span>,<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">atan2</span><span style="color: #66cc66;">&#40;</span>C.<span style="color: #006600;">y</span> - D.<span style="color: #006600;">y</span>,C.<span style="color: #006600;">x</span> - D.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> / <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">return</span> a &lt; b;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2009/05/27/knowing-if-a-point-is-behind-a-line/&ztz=Knowing if a Point is behind a Line'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2009/05/27/knowing-if-a-point-is-behind-a-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Find intersection of a Line and Quadratic Curve</title>
		<link>http://keith-hair.net/blog/2009/05/19/find-intersection-of-a-line-and-quadratic-curve/</link>
		<comments>http://keith-hair.net/blog/2009/05/19/find-intersection-of-a-line-and-quadratic-curve/#comments</comments>
		<pubDate>Wed, 20 May 2009 00:21:54 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Curves]]></category>
		<category><![CDATA[Intersection]]></category>
		<category><![CDATA[Line]]></category>
		<category><![CDATA[Point]]></category>
		<category><![CDATA[Quadratic]]></category>

		<guid isPermaLink="false">http://keith-hair.net/blog/?p=41</guid>
		<description><![CDATA[After writing a function to test intersections of a line to a polygon, another problem came up where I needed to test an intersection of a line to a curve. I'm sure there is a library someone has wrote that could do this but there is some fun in figuring out puzzles. There was a [...]]]></description>
			<content:encoded><![CDATA[<p>After writing a function to test intersections of a line to a polygon, another problem came up where I needed<br />
to test an intersection of a line to a curve. I'm sure there is a library someone has wrote that could do this but there is some fun in figuring out puzzles.<br />
There was a recent comment about curves and intersections so I decided to go ahead an post what I attempted.<br />
I feel using a loop is expensive, but it's all I can think of doing for this, similar to the <a href="http://keith-hair.net/blog/2008/08/08/line-to-polygon-intersection-data/">lineIntersectPoly </a>function.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_line_to_curve_intersection_1835312423"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="/blog/examples/curves/line_to_curve_intersection.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/blog/examples/curves/line_to_curve_intersection.swf"
			name="fm_line_to_curve_intersection_1835312423"
			width="550"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
<span id="more-41"></span></p>
<pre class="actionscript">&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/*---------------------------------------------------------------------------
Returns Array of intersection Points on a quadratic curve.
An empty Array is returned if no intersection is found.
&nbsp;
Parameters:
A		-Start Point of a segment to make intersection.
B		-End Point of a segment to make intersection.
sp		-Start Point of curve.
cp		-Control Point of curve.
ep		-End Point of curve.
rez		-The resolution of curve tests
Note: Uses another function for testing the intersections:
&nbsp;
http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/
&nbsp;
----------------------------------------------------------------------------*/</span>
<span style="color: #000000; font-weight: bold;">function</span> lineToQCurve_Intersect<span style="color: #66cc66;">&#40;</span>A:Point,B:Point,sp:Point,cp:Point,ep:Point,rez:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">80</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">//rez less than 2 is almost &quot;Pointless&quot; LOL.</span>
	<span style="color: #000000; font-weight: bold;">var</span> low:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">2</span>;
	<span style="color: #000000; font-weight: bold;">var</span> high:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">99</span>; <span style="color: #808080; font-style: italic;">//100 causes infinite loop.</span>
	rez=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#40;</span>low,high<span style="color: #66cc66;">&#41;</span>,rez<span style="color: #66cc66;">&#41;</span>,high<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> t:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;
	<span style="color: #000000; font-weight: bold;">var</span> ft:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;
	<span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">99</span>/rez;
	<span style="color: #000000; font-weight: bold;">var</span> C:Point=<span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> D:Point=<span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> L:Point=<span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> ip:Point;
	<span style="color: #000000; font-weight: bold;">var</span> a:<span style="color: #0066CC;">Array</span>=<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
	<span style="color: #808080; font-style: italic;">//test possible segment intersections in a loop.</span>
	<span style="color: #000000; font-weight: bold;">var</span> z:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">100</span>;
	<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>z &gt; <span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		t=z/<span style="color: #cc66cc;">100</span>;
		C.<span style="color: #006600;">x</span>=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">pow</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>-t,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>*sp.<span style="color: #006600;">x</span><span style="color: #cc66cc;">+2</span>*<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>-t<span style="color: #66cc66;">&#41;</span>*t*cp.<span style="color: #006600;">x</span>+<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">pow</span><span style="color: #66cc66;">&#40;</span>t,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>*ep.<span style="color: #006600;">x</span>;
		C.<span style="color: #006600;">y</span>=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">pow</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>-t,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>*sp.<span style="color: #006600;">y</span><span style="color: #cc66cc;">+2</span>*<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>-t<span style="color: #66cc66;">&#41;</span>*t*cp.<span style="color: #006600;">y</span>+<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">pow</span><span style="color: #66cc66;">&#40;</span>t,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>*ep.<span style="color: #006600;">y</span>;
		D=L;<span style="color: #808080; font-style: italic;">//Connect start to last end point</span>
		L=C.<span style="color: #006600;">clone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>z == <span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			D=ep.<span style="color: #006600;">clone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		ip=lineIntersectLine<span style="color: #66cc66;">&#40;</span>A,B,C,D<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>ip != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			a.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>ip<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>a.<span style="color: #0066CC;">length</span> == <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">break</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
		z-=n;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">return</span> a;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2009/05/19/find-intersection-of-a-line-and-quadratic-curve/&ztz=Find intersection of a Line and Quadratic Curve'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2009/05/19/find-intersection-of-a-line-and-quadratic-curve/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Constrain a Point to a Line</title>
		<link>http://keith-hair.net/blog/2008/12/27/constrain-a-point-to-a-line/</link>
		<comments>http://keith-hair.net/blog/2008/12/27/constrain-a-point-to-a-line/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 17:42:20 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Constrain]]></category>
		<category><![CDATA[Line]]></category>
		<category><![CDATA[Point]]></category>

		<guid isPermaLink="false">http://keith-hair.net/blog/?p=27</guid>
		<description><![CDATA["Drag and Drop" behavior is easy to do in ActionScript, but sometimes it would be cooler if you could limit or constrain the dragging movement of an object to a line. This opens the door for implementing more creative interaction design... 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ctoline_158944485"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="/blog/examples/constrain/ctoline.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/blog/examples/constrain/ctoline.swf"
			name="fm_ctoline_158944485"
			width="550"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object> &#160; /*--------------------------------------------------------------------------- Returns the closest Point on Line &#34;AB&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>"Drag and Drop" behavior is easy to do in ActionScript, but sometimes it would be cooler if you could limit or constrain the dragging movement of an object to a line. This opens the door for implementing<br />
more creative interaction design...</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ctoline_1638064964"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="/blog/examples/constrain/ctoline.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/blog/examples/constrain/ctoline.swf"
			name="fm_ctoline_1638064964"
			width="550"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><span id="more-27"></span></p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">/*---------------------------------------------------------------------------
Returns the closest Point on Line &quot;AB&quot; to Point &quot;p&quot;:
&nbsp;
p			-Point, the Point to constrain to the line.
A			-Point, beginning Point of Line.
B			-Point, ending Point of Line.
as_seg	-Boolean, limits return Point between endpoints of A and B.
----------------------------------------------------------------------------*/</span>
<span style="color: #000000; font-weight: bold;">function</span> constrainPointToLine<span style="color: #66cc66;">&#40;</span>p:Point,A:Point,B:Point,as_seg:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>:Point
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> cp:Point=<span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> dx:<span style="color: #0066CC;">Number</span>;
    <span style="color: #000000; font-weight: bold;">var</span> dy:<span style="color: #0066CC;">Number</span>;
    <span style="color: #000000; font-weight: bold;">var</span> t:<span style="color: #0066CC;">Number</span>;
&nbsp;
    dx = B.<span style="color: #006600;">x</span> - A.<span style="color: #006600;">x</span>;
    dy = B.<span style="color: #006600;">y</span> - A.<span style="color: #006600;">y</span>;
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>dx == <span style="color: #cc66cc;">0</span> &amp;&amp; dy == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        cp.<span style="color: #006600;">x</span> = A.<span style="color: #006600;">x</span>;
        cp.<span style="color: #006600;">y</span> = A.<span style="color: #006600;">y</span>;
    <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span>
        t = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>p.<span style="color: #006600;">x</span> - A.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> * dx + <span style="color: #66cc66;">&#40;</span>p.<span style="color: #006600;">y</span> - A.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span> * dy<span style="color: #66cc66;">&#41;</span> / <span style="color: #66cc66;">&#40;</span>dx * dx + dy * dy<span style="color: #66cc66;">&#41;</span>;
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>as_seg<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			t = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,t<span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
        cp.<span style="color: #006600;">x</span> = A.<span style="color: #006600;">x</span> + t * dx;
        cp.<span style="color: #006600;">y</span> = A.<span style="color: #006600;">y</span> + t * dy;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">return</span> cp;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2008/12/27/constrain-a-point-to-a-line/&ztz=Constrain a Point to a Line'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2008/12/27/constrain-a-point-to-a-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Line to Polygon intersection data</title>
		<link>http://keith-hair.net/blog/2008/08/08/line-to-polygon-intersection-data/</link>
		<comments>http://keith-hair.net/blog/2008/08/08/line-to-polygon-intersection-data/#comments</comments>
		<pubDate>Sat, 09 Aug 2008 03:59:24 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Intersection]]></category>
		<category><![CDATA[Line]]></category>
		<category><![CDATA[Point]]></category>
		<category><![CDATA[Polygon]]></category>

		<guid isPermaLink="false">http://keith-hair.com/blog/?p=24</guid>
		<description><![CDATA[This Actionscript 3 function returns some properties that are about a line-to-polygon intersection. It's useful for knowing all intersection points of a segment intersecting with a polygon, and knowing if the end points of the segment are inside the polygon. 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_line_to_polygon_intersection_1157499512"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="/blog/examples/intersections/line_to_polygon_intersection.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/blog/examples/intersections/line_to_polygon_intersection.swf"
			name="fm_line_to_polygon_intersection_1157499512"
			width="550"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object> This uses the "lineIntersectLine" function of the earlier post. &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>This Actionscript 3 function returns some properties that are about a line-to-polygon intersection.<br />
It's useful for knowing all intersection points of a segment intersecting with a polygon, and knowing if the end points of the segment are inside the polygon.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_line_to_polygon_intersection_2122786143"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="/blog/examples/intersections/line_to_polygon_intersection.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/blog/examples/intersections/line_to_polygon_intersection.swf"
			name="fm_line_to_polygon_intersection_2122786143"
			width="550"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><span id="more-24"></span></p>
<p>This uses the "<a href="http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/">lineIntersectLine</a>" function of the earlier post.</p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">/*---------------------------------------------------------------------------
Returns an Object with the following properties:
intersects        -Boolean indicating if an intersection exists.
start_inside      -Boolean indicating if Point A is inside of the polygon.
end_inside       -Boolean indicating if Point B is inside of the polygon.
intersections    -Array of intersection Points along the polygon.
centroid          -A Point indicating &quot;center of mass&quot; of the polygon.
&nbsp;
&quot;pArry&quot; is an Array of Points.
----------------------------------------------------------------------------*/</span>
<span style="color: #000000; font-weight: bold;">function</span> lineIntersectPoly<span style="color: #66cc66;">&#40;</span>A : Point, B : Point, pArry:<span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Object</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> An:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">1</span>;
	<span style="color: #000000; font-weight: bold;">var</span> Bn:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">1</span>;
	<span style="color: #000000; font-weight: bold;">var</span> C:Point;
	<span style="color: #000000; font-weight: bold;">var</span> D:Point;
	<span style="color: #000000; font-weight: bold;">var</span> i:Point;
	<span style="color: #000000; font-weight: bold;">var</span> cx:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;
	<span style="color: #000000; font-weight: bold;">var</span> cy:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;
	<span style="color: #000000; font-weight: bold;">var</span> result:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> pa:<span style="color: #0066CC;">Array</span>=pArry.<span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//Copy to prevent growing points when connecting ends.</span>
        pa.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>pa<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//Create line from last Point to beginning Point</span>
	result.<span style="color: #006600;">intersects</span> = <span style="color: #000000; font-weight: bold;">false</span>;
	result.<span style="color: #006600;">intersections</span>=<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
	result.<span style="color: #006600;">start_inside</span>=<span style="color: #000000; font-weight: bold;">false</span>;
	result.<span style="color: #006600;">end_inside</span>=<span style="color: #000000; font-weight: bold;">false</span>;
	<span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">int</span>=pa.<span style="color: #006600;">length</span><span style="color: #cc66cc;">-1</span>;
	<span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>n &gt; <span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		C=Point<span style="color: #66cc66;">&#40;</span>pa<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>n &gt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			cx+=C.<span style="color: #006600;">x</span>;
			cy+=C.<span style="color: #006600;">y</span>;
			D=Point<span style="color: #66cc66;">&#40;</span>pa<span style="color: #66cc66;">&#91;</span>n<span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>||Point<span style="color: #66cc66;">&#40;</span>pa<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
			i=lineIntersectLine<span style="color: #66cc66;">&#40;</span>A,B,C,D<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>i != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				result.<span style="color: #006600;">intersections</span>.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>lineIntersectLine<span style="color: #66cc66;">&#40;</span>A,<span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>C.<span style="color: #006600;">x</span>+D.<span style="color: #006600;">x</span>,A.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>,C,D<span style="color: #66cc66;">&#41;</span> != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				An++;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>lineIntersectLine<span style="color: #66cc66;">&#40;</span>B,<span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>C.<span style="color: #006600;">x</span>+D.<span style="color: #006600;">x</span>,B.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>,C,D<span style="color: #66cc66;">&#41;</span> != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				Bn++;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
		n--;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>An % <span style="color: #cc66cc;">2</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		result.<span style="color: #006600;">start_inside</span>=<span style="color: #000000; font-weight: bold;">true</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>Bn % <span style="color: #cc66cc;">2</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		result.<span style="color: #006600;">end_inside</span>=<span style="color: #000000; font-weight: bold;">true</span>;
	<span style="color: #66cc66;">&#125;</span>
	result.<span style="color: #006600;">centroid</span>=<span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>cx/<span style="color: #66cc66;">&#40;</span>pa.<span style="color: #006600;">length</span><span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span>,cy/<span style="color: #66cc66;">&#40;</span>pa.<span style="color: #006600;">length</span><span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	result.<span style="color: #006600;">intersects</span> = result.<span style="color: #006600;">intersections</span>.<span style="color: #0066CC;">length</span> &gt; <span style="color: #cc66cc;">0</span>;
	<span style="color: #b1b100;">return</span> result;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2008/08/08/line-to-polygon-intersection-data/&ztz=Line to Polygon intersection data'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2008/08/08/line-to-polygon-intersection-data/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Line to Circle Intersection data</title>
		<link>http://keith-hair.net/blog/2008/08/05/line-to-circle-intersection-data/</link>
		<comments>http://keith-hair.net/blog/2008/08/05/line-to-circle-intersection-data/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 07:45:17 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash 9]]></category>
		<category><![CDATA[Circle]]></category>
		<category><![CDATA[Intersection]]></category>
		<category><![CDATA[Line]]></category>

		<guid isPermaLink="false">http://keith-hair.com/blog/?p=23</guid>
		<description><![CDATA[Here is an ActionScript 3 function that will return intersection information between a segment and circle. It's useful to me to know if a segment is partially intersecting with a circle or going completely through. 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_line_to_circle_intersection_1636387005"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="/blog/examples/intersections/line_to_circle_intersection.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/blog/examples/intersections/line_to_circle_intersection.swf"
			name="fm_line_to_circle_intersection_1636387005"
			width="550"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object> &#160; /*--------------------------------------------------------------------------- Returns an Object with the following properties: enter -Intersection Point entering the circle. [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an ActionScript 3 function that will return intersection information between a segment and circle.<br />
It's useful to me to know if a segment is partially intersecting with a circle or going completely through.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_line_to_circle_intersection_1673893655"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="/blog/examples/intersections/line_to_circle_intersection.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/blog/examples/intersections/line_to_circle_intersection.swf"
			name="fm_line_to_circle_intersection_1673893655"
			width="550"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
<span id="more-23"></span></p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">/*---------------------------------------------------------------------------
Returns an Object with the following properties:
	enter			-Intersection Point entering the circle.
	exit			-Intersection Point exiting the circle.
	inside			-Boolean indicating if the points of the line are inside the circle.
	tangent		-Boolean indicating if line intersect at one point of the circle.
	intersects		-Boolean indicating if there is an intersection of the points and the circle.
&nbsp;
If both &quot;enter&quot; and &quot;exit&quot; are null, or &quot;intersects&quot; == false, it indicates there is no intersection.
&nbsp;
This is a customization of the intersectCircleLine Javascript function found here:
&nbsp;
http://www.kevlindev.com/gui/index.htm
&nbsp;
----------------------------------------------------------------------------*/</span>
<span style="color: #000000; font-weight: bold;">function</span> lineIntersectCircle<span style="color: #66cc66;">&#40;</span>A : Point, B : Point, C : Point, r : <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Object</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> result : <span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	result.<span style="color: #006600;">inside</span> = <span style="color: #000000; font-weight: bold;">false</span>;
	result.<span style="color: #006600;">tangent</span> = <span style="color: #000000; font-weight: bold;">false</span>;
	result.<span style="color: #006600;">intersects</span> = <span style="color: #000000; font-weight: bold;">false</span>;
	result.<span style="color: #0066CC;">enter</span>=<span style="color: #000000; font-weight: bold;">null</span>;
	result.<span style="color: #006600;">exit</span>=<span style="color: #000000; font-weight: bold;">null</span>;
	<span style="color: #000000; font-weight: bold;">var</span> a : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span>B.<span style="color: #006600;">x</span> - A.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> * <span style="color: #66cc66;">&#40;</span>B.<span style="color: #006600;">x</span> - A.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #66cc66;">&#40;</span>B.<span style="color: #006600;">y</span> - A.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span> * <span style="color: #66cc66;">&#40;</span>B.<span style="color: #006600;">y</span> - A.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> b : <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">2</span> * <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>B.<span style="color: #006600;">x</span> - A.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> * <span style="color: #66cc66;">&#40;</span>A.<span style="color: #006600;">x</span> - C.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> +<span style="color: #66cc66;">&#40;</span>B.<span style="color: #006600;">y</span> - A.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span> * <span style="color: #66cc66;">&#40;</span>A.<span style="color: #006600;">y</span> - C.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> cc : <span style="color: #0066CC;">Number</span> = C.<span style="color: #006600;">x</span> * C.<span style="color: #006600;">x</span> + C.<span style="color: #006600;">y</span> * C.<span style="color: #006600;">y</span> + A.<span style="color: #006600;">x</span> * A.<span style="color: #006600;">x</span> + A.<span style="color: #006600;">y</span> * A.<span style="color: #006600;">y</span> - <span style="color: #cc66cc;">2</span> * <span style="color: #66cc66;">&#40;</span>C.<span style="color: #006600;">x</span> * A.<span style="color: #006600;">x</span> + C.<span style="color: #006600;">y</span> * A.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span> - r * r;
	<span style="color: #000000; font-weight: bold;">var</span> deter : <span style="color: #0066CC;">Number</span> = b * b - <span style="color: #cc66cc;">4</span> * a * cc;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>deter &lt;= <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		result.<span style="color: #006600;">inside</span> = <span style="color: #000000; font-weight: bold;">false</span>;
	<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">e</span> : <span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sqrt</span> <span style="color: #66cc66;">&#40;</span>deter<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">var</span> u1 : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span> - b + <span style="color: #0066CC;">e</span> <span style="color: #66cc66;">&#41;</span> / <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span> * a <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">var</span> u2 : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span> - b - <span style="color: #0066CC;">e</span> <span style="color: #66cc66;">&#41;</span> / <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span> * a <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>u1 &lt; <span style="color: #cc66cc;">0</span> || u1 &gt; <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #66cc66;">&#40;</span>u2 &lt; <span style="color: #cc66cc;">0</span> || u2 &gt; <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>u1 &lt; <span style="color: #cc66cc;">0</span> &amp;&amp; u2 &lt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> || <span style="color: #66cc66;">&#40;</span>u1 &gt; <span style="color: #cc66cc;">1</span> &amp;&amp; u2 &gt; <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				result.<span style="color: #006600;">inside</span> = <span style="color: #000000; font-weight: bold;">false</span>;
			<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
				result.<span style="color: #006600;">inside</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span> &lt;= u2 &amp;&amp; u2 &lt;= <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				result.<span style="color: #0066CC;">enter</span>=Point.<span style="color: #006600;">interpolate</span> <span style="color: #66cc66;">&#40;</span>A, B, <span style="color: #cc66cc;">1</span> - u2<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span> &lt;= u1 &amp;&amp; u1 &lt;= <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				result.<span style="color: #006600;">exit</span>=Point.<span style="color: #006600;">interpolate</span> <span style="color: #66cc66;">&#40;</span>A, B, <span style="color: #cc66cc;">1</span> - u1<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			result.<span style="color: #006600;">intersects</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>result.<span style="color: #006600;">exit</span> != <span style="color: #000000; font-weight: bold;">null</span> &amp;&amp; result.<span style="color: #0066CC;">enter</span> != <span style="color: #000000; font-weight: bold;">null</span> &amp;&amp; result.<span style="color: #006600;">exit</span>.<span style="color: #006600;">equals</span> <span style="color: #66cc66;">&#40;</span>result.<span style="color: #0066CC;">enter</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				result.<span style="color: #006600;">tangent</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">return</span> result;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2008/08/05/line-to-circle-intersection-data/&ztz=Line to Circle Intersection data'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2008/08/05/line-to-circle-intersection-data/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

