IntersectPlaneAndSphere:

---------------------------------------------------------------------------
   Finds the vector giving the intersection
   of a plane and a sphere. 

   The normal is

   n = ai + bj + ck

   The equation of the plane is

   a(x-x1) + b(y - y1) + c(z - z1) = 0

   where [x1;y1;z1] is a point in the plane. 

   For example, the xy-plane is

   z = 0 which is generated by
   a = 0, b = 0, c = 1 and [x1;y1;z1] = [dont care;dont care;0].

   If no input arguments are entered it will generate a random plane.
   If no output arguments are specified it will plot the intersection.

---------------------------------------------------------------------------
   Form:
   v = IntersectPlaneAndSphere( r, plane, n )
---------------------------------------------------------------------------

   ------
   Inputs
   ------
   r          (1,1)   Radius of sphere
   plane      (1,1)   Data structure for plane
                      .n   (3,1) Normal
                      .x   (3,1) Point in the plane
   n          (1,1)   Half the number of points on the equation of
                      the intersection ellipse. The default is 50.

   -------
   Outputs
   -------
   v          (:)     Data structure
                      .x         (3,n) Coordinates of the intersection
                      .intersect (1,1) 1 if the plane intersects the sphere

---------------------------------------------------------------------------

Children:

Common: Graphics/Axis3D
Common: Graphics/NewFig
Common: Graphics/XLabelS
Common: Graphics/YLabelS
Common: Graphics/ZLabelS
Common: Math/Unit
Common: Coord/Q2Mat
Common: Coord/U2Q