<?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>Shyam Guthikonda &#187; physics</title>
	<atom:link href="http://www.shy.am/tag/physics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shy.am</link>
	<description>Game Programmer - http://shy.am</description>
	<lastBuildDate>Mon, 14 Mar 2011 12:18:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Ray-Sphere Intersection</title>
		<link>http://www.shy.am/2009/08/ray-sphere-intersection/</link>
		<comments>http://www.shy.am/2009/08/ray-sphere-intersection/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 14:16:54 +0000</pubDate>
		<dc:creator>shyam</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[physics]]></category>

		<guid isPermaLink="false">http://www.shy.am/?p=718</guid>
		<description><![CDATA[A ray, , where is the origin of the ray, is the direction of the ray, and is the distance along the ray: Equation of a sphere: A point on the surface of the sphere, , and the center of the sphere, : Plug in the ray and solve for : We now have a [...]]]></description>
			<content:encoded><![CDATA[<p>A ray, <img src='http://s.wordpress.com/latex.php?latex=%5Cmathbf%7Br%7D%28t%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbf{r}(t)' title='\mathbf{r}(t)' class='latex' />, where <img src='http://s.wordpress.com/latex.php?latex=%5Cmathbf%7Bo%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbf{o}' title='\mathbf{o}' class='latex' /> is the origin of the ray, <img src='http://s.wordpress.com/latex.php?latex=%5Cmathbf%7Bd%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbf{d}' title='\mathbf{d}' class='latex' /> is the direction of the ray, and <img src='http://s.wordpress.com/latex.php?latex=t&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t' title='t' class='latex' /> is the distance along the ray:</p>
<p><center><img src='http://s.wordpress.com/latex.php?latex=%5Cmathbf%7Br%7D%28t%29%20%3D%20%5Cmathbf%7Bo%7D%20%2B%20%5Cmathbf%7Bd%7D%20t&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbf{r}(t) = \mathbf{o} + \mathbf{d} t' title='\mathbf{r}(t) = \mathbf{o} + \mathbf{d} t' class='latex' /></center></p>
<p></p>
<p>Equation of a sphere:</p>
<p><center><img src='http://s.wordpress.com/latex.php?latex=x%5E2%20%2B%20y%5E2%20%2B%20z%5E2%20%3D%20%5Cmathbf%7Bp%7D%20%5Ccdot%20%5Cmathbf%7Bp%7D%20%3D%20r%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x^2 + y^2 + z^2 = \mathbf{p} \cdot \mathbf{p} = r^2' title='x^2 + y^2 + z^2 = \mathbf{p} \cdot \mathbf{p} = r^2' class='latex' /></center></p>
<p></p>
<p>A point on the surface of the sphere, <img src='http://s.wordpress.com/latex.php?latex=%5Cmathbf%7Bp%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbf{p}' title='\mathbf{p}' class='latex' />, and the center of the sphere, <img src='http://s.wordpress.com/latex.php?latex=%5Cmathbf%7Bp_c%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbf{p_c}' title='\mathbf{p_c}' class='latex' />:</p>
<p><center><img src='http://s.wordpress.com/latex.php?latex=%28%5Cmathbf%7Bp%20-%20p_c%7D%29%20%5Ccdot%20%28%5Cmathbf%7Bp%20-%20p_c%7D%29%20-%20r%5E2%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\mathbf{p - p_c}) \cdot (\mathbf{p - p_c}) - r^2 = 0' title='(\mathbf{p - p_c}) \cdot (\mathbf{p - p_c}) - r^2 = 0' class='latex' /></center></p>
<p></p>
<p>Plug in the ray and solve for <img src='http://s.wordpress.com/latex.php?latex=t&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t' title='t' class='latex' />:</p>
<p><center><img src='http://s.wordpress.com/latex.php?latex=%28%5Cmathbf%7Br%7D%28t%29%20-%20%5Cmathbf%7Bp_c%7D%29%20%5Ccdot%20%28%5Cmathbf%7Br%7D%28t%29%20-%20%5Cmathbf%7Bp_c%7D%29%20-%20r%5E2%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\mathbf{r}(t) - \mathbf{p_c}) \cdot (\mathbf{r}(t) - \mathbf{p_c}) - r^2 = 0' title='(\mathbf{r}(t) - \mathbf{p_c}) \cdot (\mathbf{r}(t) - \mathbf{p_c}) - r^2 = 0' class='latex' /></p>
<p></p>
<img src='http://s.wordpress.com/latex.php?latex=%28t%20%5Cmathbf%7Bd%7D%20%2B%20%5Cmathbf%7Bo%20-%20p_c%7D%29%20%5Ccdot%20%28t%20%5Cmathbf%7Bd%7D%20%2B%20%5Cmathbf%7Bo%20-%20p_c%7D%29%20-%20r%5E2%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(t \mathbf{d} + \mathbf{o - p_c}) \cdot (t \mathbf{d} + \mathbf{o - p_c}) - r^2 = 0' title='(t \mathbf{d} + \mathbf{o - p_c}) \cdot (t \mathbf{d} + \mathbf{o - p_c}) - r^2 = 0' class='latex' />
<img src='http://s.wordpress.com/latex.php?latex=%5Cmathbf%7Bd%7D%20%5Ccdot%20%5Cmathbf%7Bd%7D%20t%5E2%20%2B%20%5Cmathbf%7Bd%7D%20%5Ccdot%20%28%5Cmathbf%7Bo%20-%20p_c%7D%29t%20%2B%20%5Cmathbf%7Bd%7D%20%5Ccdot%20%28%5Cmathbf%7Bo%20-%20p_c%7D%29t%20%2B%20%28%5Cmathbf%7Bo%20-%20p_c%7D%29%20%5Ccdot%20%28%5Cmathbf%7Bo%20-%20p_c%7D%29%20-%20r%5E2%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbf{d} \cdot \mathbf{d} t^2 + \mathbf{d} \cdot (\mathbf{o - p_c})t + \mathbf{d} \cdot (\mathbf{o - p_c})t + (\mathbf{o - p_c}) \cdot (\mathbf{o - p_c}) - r^2 = 0' title='\mathbf{d} \cdot \mathbf{d} t^2 + \mathbf{d} \cdot (\mathbf{o - p_c})t + \mathbf{d} \cdot (\mathbf{o - p_c})t + (\mathbf{o - p_c}) \cdot (\mathbf{o - p_c}) - r^2 = 0' class='latex' />
<img src='http://s.wordpress.com/latex.php?latex=%5Cmathbf%7Bd%7D%20%5Ccdot%20%5Cmathbf%7Bd%7D%20t%5E2%20%2B%202%5Cmathbf%7Bd%7D%20%5Ccdot%20%28%5Cmathbf%7Bo%20-%20p_c%7D%29t%20%2B%20%28%5Cmathbf%7Bo%20-%20p_c%7D%29%20%5Ccdot%20%28%5Cmathbf%7Bo%20-%20p_c%7D%29%20-%20r%5E2%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbf{d} \cdot \mathbf{d} t^2 + 2\mathbf{d} \cdot (\mathbf{o - p_c})t + (\mathbf{o - p_c}) \cdot (\mathbf{o - p_c}) - r^2 = 0' title='\mathbf{d} \cdot \mathbf{d} t^2 + 2\mathbf{d} \cdot (\mathbf{o - p_c})t + (\mathbf{o - p_c}) \cdot (\mathbf{o - p_c}) - r^2 = 0' class='latex' /></center></p>
<p></p>
<p>We now have a quadratic equation of the form <img src='http://s.wordpress.com/latex.php?latex=At%5E2%20%2B%20Bt%20%2B%20C%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='At^2 + Bt + C = 0' title='At^2 + Bt + C = 0' class='latex' />, where:</p>
<p><center><img src='http://s.wordpress.com/latex.php?latex=A%20%3D%20%5Cmathbf%7Bd%20%5Ccdot%20d%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='A = \mathbf{d \cdot d}' title='A = \mathbf{d \cdot d}' class='latex' />
<p></p>
<img src='http://s.wordpress.com/latex.php?latex=B%20%3D%202%5Cmathbf%7Bd%20%5Ccdot%20%28o%20-%20p_c%29%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='B = 2\mathbf{d \cdot (o - p_c)}' title='B = 2\mathbf{d \cdot (o - p_c)}' class='latex' />
<p><img src='http://s.wordpress.com/latex.php?latex=C%20%3D%20%5Cmathbf%7B%28o%20-%20p_c%29%20%5Ccdot%20%28o%20-%20p_c%29%7D%20-%20r%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C = \mathbf{(o - p_c) \cdot (o - p_c)} - r^2' title='C = \mathbf{(o - p_c) \cdot (o - p_c)} - r^2' class='latex' /></center></p>
<p></p>
<p>This can be plugged into the quadratic formula:</p>
<p><center><img src='http://s.wordpress.com/latex.php?latex=%5Cfrac%7B%7B%20-%20B%20%5Cpm%20%5Csqrt%20%7BB%5E2%20%20-%204AC%7D%20%7D%7D%20%7B%7B2A%7D%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\frac{{ - B \pm \sqrt {B^2  - 4AC} }} {{2A}}' title='\frac{{ - B \pm \sqrt {B^2  - 4AC} }} {{2A}}' class='latex' /></center></p>
<p></p>
<ul>
<li>If the determinant, <img src='http://s.wordpress.com/latex.php?latex=B%5E2%20-%204AC&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='B^2 - 4AC' title='B^2 - 4AC' class='latex' />, is negative, there exist no real roots and therefore there is no intersection.</li>
<li>If the determinant is 0, there is exactly one intersection; the ray is tangent to the sphere at this single point.</li>
<li>If the determinant is positive, there are two intersections. The ray penetrates the sphere: one point in, one point out.</li>
<li>If <img src='http://s.wordpress.com/latex.php?latex=t%20%3C%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t &lt; 0' title='t &lt; 0' class='latex' />, the intersection is 'behind' the ray starting point.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.shy.am/2009/08/ray-sphere-intersection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

