﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Find Intersection Point of two lines in AS3</title>
	<atom:link href="http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/feed/" rel="self" type="application/rss+xml" />
	<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/</link>
	<description>Scripting is fun like any other hobby</description>
	<lastBuildDate>Sun, 08 Jan 2012 09:59:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: El Verde</title>
		<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/comment-page-1/#comment-1514</link>
		<dc:creator>El Verde</dc:creator>
		<pubDate>Tue, 15 Nov 2011 20:26:01 +0000</pubDate>
		<guid isPermaLink="false">http://keith-hair.com/blog/?p=22#comment-1514</guid>
		<description>The as_seg check can be optimized still further if you consider you&#039;re just checking to see that the intersection falls between A.x and B.x, between A.y and B.y, between E.x and F.x, and between E.y and F.y:

if ( as_seg ) {
    if (  ( ip.x - A.x ) * ( ip.x - B.x ) &gt; 0
      &#124;&#124;  ( ip.y - A.y ) * ( ip.y - B.y ) &gt; 0
      &#124;&#124;  ( ip.x - E.x ) * ( ip.x - F.x ) &gt; 0
      &#124;&#124;  ( ip.y - E.y ) * ( ip.y - F.y ) &gt; 0
    ) return null ;
}</description>
		<content:encoded><![CDATA[<p>The as_seg check can be optimized still further if you consider you&#8217;re just checking to see that the intersection falls between A.x and B.x, between A.y and B.y, between E.x and F.x, and between E.y and F.y:</p>
<p>if ( as_seg ) {<br />
    if (  ( ip.x &#8211; A.x ) * ( ip.x &#8211; B.x ) &gt; 0<br />
      ||  ( ip.y &#8211; A.y ) * ( ip.y &#8211; B.y ) &gt; 0<br />
      ||  ( ip.x &#8211; E.x ) * ( ip.x &#8211; F.x ) &gt; 0<br />
      ||  ( ip.y &#8211; E.y ) * ( ip.y &#8211; F.y ) &gt; 0<br />
    ) return null ;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheetal</title>
		<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/comment-page-1/#comment-1437</link>
		<dc:creator>Sheetal</dc:creator>
		<pubDate>Wed, 21 Sep 2011 05:53:29 +0000</pubDate>
		<guid isPermaLink="false">http://keith-hair.com/blog/?p=22#comment-1437</guid>
		<description>Thanks a ton!!!
You saved me a looot of work!!!</description>
		<content:encoded><![CDATA[<p>Thanks a ton!!!<br />
You saved me a looot of work!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent</title>
		<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/comment-page-1/#comment-1436</link>
		<dc:creator>Laurent</dc:creator>
		<pubDate>Wed, 21 Sep 2011 03:47:41 +0000</pubDate>
		<guid isPermaLink="false">http://keith-hair.com/blog/?p=22#comment-1436</guid>
		<description>I&#039;ve been looking for this kind of function for an hour, thank you so much! Great code that can easily be copied and pasted and with a nice demo.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been looking for this kind of function for an hour, thank you so much! Great code that can easily be copied and pasted and with a nice demo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ingo</title>
		<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/comment-page-1/#comment-1400</link>
		<dc:creator>Ingo</dc:creator>
		<pubDate>Wed, 10 Aug 2011 20:35:53 +0000</pubDate>
		<guid isPermaLink="false">http://keith-hair.com/blog/?p=22#comment-1400</guid>
		<description>Great work!

Any idea how it works with coinciding lines that are intersecting?
I know that there might be multiple points that will intersect, but let&#039;s assume that we only return the upper left point.</description>
		<content:encoded><![CDATA[<p>Great work!</p>
<p>Any idea how it works with coinciding lines that are intersecting?<br />
I know that there might be multiple points that will intersect, but let&#8217;s assume that we only return the upper left point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adg</title>
		<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/comment-page-1/#comment-1165</link>
		<dc:creator>adg</dc:creator>
		<pubDate>Sun, 26 Dec 2010 18:22:35 +0000</pubDate>
		<guid isPermaLink="false">http://keith-hair.com/blog/?p=22#comment-1165</guid>
		<description>Excellent - Thanks!</description>
		<content:encoded><![CDATA[<p>Excellent &#8211; Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniele</title>
		<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/comment-page-1/#comment-1123</link>
		<dc:creator>Daniele</dc:creator>
		<pubDate>Wed, 15 Dec 2010 11:12:31 +0000</pubDate>
		<guid isPermaLink="false">http://keith-hair.com/blog/?p=22#comment-1123</guid>
		<description>Hi Keith,

thanks a lot for this piece of code. Works perfectly :)

I&#039;m using it to determine intersections during graphs display. I have to check lots of segments, thus I optimized the &quot;as_seg&quot; part a little. I removed Math.pow, which is quite slow, and didn&#039;t repeat any multiplication/subtraction. I thought I might post it (approx 1.78 times faster):

if ( as_seg ) {
    var n0:Number, n1:Number, n2:Number, n3:Number, n4:Number, n5:Number, n6:Number, n7:Number, v0:Number, v1:Number, vr0:Number, vr1:Number;
    n0 = ip.x - p_a1.x;
    n1 = ip.y - p_a1.y;
    v0 = p_a0.y - p_a1.y;
    vr0 = b1 * b1 + v0 * v0;
    if ( n0 * n0 + n1 * n1 &gt; vr0 )		return null;
    n2 = ip.x - p_a0.x;
    n3 = ip.y - p_a0.y;
    if ( n2 * n2 + n3 * n3 &gt; vr0 )		return null;
    n4 = ip.x - p_b1.x;
    n5 = ip.y - p_b1.y;
    v1 = p_b0.y - p_b1.y;
    vr1 = b2 * b2 + v1 * v1;
    if ( n4 * n4 + n5 * n5 &gt; vr1 )		return null;
    n6 = ip.x - p_b0.x;
    n7 = ip.y - p_b0.y;
    if ( n6 * n6 + n7 * n7 &gt; vr1 )		return null;
}

Kind regards and thanks again :)</description>
		<content:encoded><![CDATA[<p>Hi Keith,</p>
<p>thanks a lot for this piece of code. Works perfectly <img src='http://keith-hair.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;m using it to determine intersections during graphs display. I have to check lots of segments, thus I optimized the &#8220;as_seg&#8221; part a little. I removed Math.pow, which is quite slow, and didn&#8217;t repeat any multiplication/subtraction. I thought I might post it (approx 1.78 times faster):</p>
<p>if ( as_seg ) {<br />
    var n0:Number, n1:Number, n2:Number, n3:Number, n4:Number, n5:Number, n6:Number, n7:Number, v0:Number, v1:Number, vr0:Number, vr1:Number;<br />
    n0 = ip.x &#8211; p_a1.x;<br />
    n1 = ip.y &#8211; p_a1.y;<br />
    v0 = p_a0.y &#8211; p_a1.y;<br />
    vr0 = b1 * b1 + v0 * v0;<br />
    if ( n0 * n0 + n1 * n1 &gt; vr0 )		return null;<br />
    n2 = ip.x &#8211; p_a0.x;<br />
    n3 = ip.y &#8211; p_a0.y;<br />
    if ( n2 * n2 + n3 * n3 &gt; vr0 )		return null;<br />
    n4 = ip.x &#8211; p_b1.x;<br />
    n5 = ip.y &#8211; p_b1.y;<br />
    v1 = p_b0.y &#8211; p_b1.y;<br />
    vr1 = b2 * b2 + v1 * v1;<br />
    if ( n4 * n4 + n5 * n5 &gt; vr1 )		return null;<br />
    n6 = ip.x &#8211; p_b0.x;<br />
    n7 = ip.y &#8211; p_b0.y;<br />
    if ( n6 * n6 + n7 * n7 &gt; vr1 )		return null;<br />
}</p>
<p>Kind regards and thanks again <img src='http://keith-hair.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Preeja</title>
		<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/comment-page-1/#comment-1107</link>
		<dc:creator>Preeja</dc:creator>
		<pubDate>Mon, 13 Dec 2010 09:50:46 +0000</pubDate>
		<guid isPermaLink="false">http://keith-hair.com/blog/?p=22#comment-1107</guid>
		<description>thank u!!! very useful.........</description>
		<content:encoded><![CDATA[<p>thank u!!! very useful&#8230;&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: derelict</title>
		<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/comment-page-1/#comment-1012</link>
		<dc:creator>derelict</dc:creator>
		<pubDate>Tue, 09 Nov 2010 19:39:44 +0000</pubDate>
		<guid isPermaLink="false">http://keith-hair.com/blog/?p=22#comment-1012</guid>
		<description>i had another approach at this (by rotating vectors), but your code is like twenty times faster. thank you so much for sharing!</description>
		<content:encoded><![CDATA[<p>i had another approach at this (by rotating vectors), but your code is like twenty times faster. thank you so much for sharing!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zephael</title>
		<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/comment-page-1/#comment-737</link>
		<dc:creator>Zephael</dc:creator>
		<pubDate>Thu, 17 Jun 2010 09:32:58 +0000</pubDate>
		<guid isPermaLink="false">http://keith-hair.com/blog/?p=22#comment-737</guid>
		<description>Thank you very much for the fine code!

I will use it under OpenCV.</description>
		<content:encoded><![CDATA[<p>Thank you very much for the fine code!</p>
<p>I will use it under OpenCV.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Calculating the Distance from a Point to a Line in AS3 &#124; Bacon and Games</title>
		<link>http://keith-hair.net/blog/2008/08/04/find-intersection-point-of-two-lines-in-as3/comment-page-1/#comment-597</link>
		<dc:creator>Calculating the Distance from a Point to a Line in AS3 &#124; Bacon and Games</dc:creator>
		<pubDate>Thu, 04 Mar 2010 01:04:32 +0000</pubDate>
		<guid isPermaLink="false">http://keith-hair.com/blog/?p=22#comment-597</guid>
		<description>[...] again I&#8217;ve built on a handy function written by Keith Hair that finds the point of intersection between two lines. Using his lineIntersectLine() function and my getPerpDistanceFromLine() function you can calculate [...]</description>
		<content:encoded><![CDATA[<p>[...] again I&#8217;ve built on a handy function written by Keith Hair that finds the point of intersection between two lines. Using his lineIntersectLine() function and my getPerpDistanceFromLine() function you can calculate [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

