CollisionMonitor:

Path: FormationFlying/Collision

% Runs the collision monitoring algorithm. 
 Checks the ellipsoids for self and a neighboring spacecraft. Self "position
 measurement" should be [0;0;0;0;0;0] at each time if relative measurements are
 used. Includes options for continuous and discrete ellipsoid propagation for
 circular and low-eccentricity reference orbits. All propagation is performed
 in Hill's frame. Assumes that no maneuvers are taking place.

--------------------------------------------------------------------------
   Form:
   [prob, d, xhat, Shat] = CollisionMonitor( action, d, jD, y );
--------------------------------------------------------------------------

   Inputs
   ------
   action  (:)    'initialize' or 'run'
   d        :     Data structure
                  .hRef          Altitude of the reference orbit (km)
                  .eRef          Eccentricity
                  .dR            Reference length of Hill's orbit (km)
                  .initBounds    Error in measurement
                  .nSC           Number of S/C 
                  .predictTime   Total amount of time to predict for
                  .nSampleTimes  Number of points in predictTime
                  .scalev        Sigma for measurement noise
                  .discrete      Flag for method type
                  .mSC           Spacecraft mass (kg)
                  .lenSC         Spacecraft length (m)
                  .diaSC         Spacecraft diameter (m)
                  .Cd            Drag coefficient
                  .Cr            Reflectivity of s/c: 0.0 for translucent; 
                                   1.0 for black-body; 2.0 for flat mirror
   jD      (1)    Epoch in Julian date
   y       (6,:)  spacecraft current position in Hill's frame

   Outputs
   --------
   prob   (n)         probability of collision    
   d      (n)         minimum distance between spacecraft position ellipsoids
   xhat   (6,n,2)     xhat, ellipsoid centers, for both spacecraft
   Shat   (6,6,n,2)   Shat, ellipsoid size matrices, for both spacecraft
 
--------------------------------------------------------------------------