<?xml version="1.0" encoding="UTF-8"?>
<Worksheet><Version major="6" minor="1"/><View-Properties><Zoom percentage="100"/></View-Properties><Styles><Layout alignment="left" bullet="none" name="Normal"/><Font background="[0,0,0]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" name="Maple Input" size="12"/><Font background="[0,0,0]" bold="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Text" opaque="false" size="12" underline="false"/></Styles><Group><Input><Text-field alignment="centred" layout="Normal" style="Text"><Font bold="true" size="18">Ray and Object Intersections: Sphere</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/><Text-field alignment="centred" layout="Normal" style="Text">
by Otto Wilke
otto_wilke@hotmail.com</Text-field><Text-field layout="Normal" style="Text"/><Text-field layout="Normal" style="Text">I am vaguely aware that graphics is normally done with vector operations, generic</Text-field><Text-field layout="Normal" style="Text">solids positioned at the origin, and transformation matrices to move rays to and fro.</Text-field><Text-field layout="Normal" style="Text"/><Text-field layout="Normal" style="Text">I thought it would be interesting to use rectangular coordinates and objects located</Text-field><Text-field layout="Normal" style="Text">anywhere in space and oriented in any direction.</Text-field><Text-field layout="Normal" style="Text"/><Text-field layout="Normal" style="Text">This is one of four files covering the plane, the sphere, the cylinder, and the cone. </Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Text">INTERSECTION OF A LINE AND A SPHERE</Text-field><Text-field layout="Normal" style="Text">Given a sphere with radius r and center at (h,k,m), then its equation is:</Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input">(x-h)^2+(y-k)^2+(z-m)^2=r^2;</Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Text">Assign known values of h, k, m, and r.</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">h:=1;k:=2;m:=1;r:=5;</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">(x-h)^2+(y-k)^2+(z-m)^2=r^2;</Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Text">If P1(x1,y1,z1) and P2(x2,y2,z2) are two points on a line L, then a=(x2-x1), b=(y2-y1), and c=(z2-z1) are</Text-field><Text-field layout="Normal" style="Text">direction numbers of L.  The line L on the point P1 and with direction numbers a, b, and c has parametric equations</Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input">x = x1 + a*t; y=y1+b*t;z=z1+c*t;</Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Text">Asign known values of x1, y1, z1, and a, b, c.</Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input">x1:=3;y1:=5;z1:=8;a:=-4;b:=-2;c:=-6;</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">x = x1 + a*t; y=y1+b*t;z=z1+c*t;</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">allvalues(solve({x = 3-4*t,y=5-2*t,z=8-6*t,(x-1)^2+(y-2)^2+(z-1)^2 = 25},{x,y,z,t}));</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">evalf(%);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">with(plots):</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">p1:=implicitplot3d((x-1)^2+(y-2)^2+(z-1)^2=25, x=-6..6, y=-6..6, z=-6..6, grid=[13,13,13]):</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">p2:=pointplot3d({[-3.329929491,1.835035255,-1.494894235],[1.329929491,4.164964745,5.494894235] },symbol=circle, symbolsize=20,color=red,axes=BOXED):</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">display({p1,p2});</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Text"/></Input></Group><Text-field/><Text-field/><Text-field/><Text-field/></Worksheet>