public static function Sat_Eclipsed(Predict_Vector $pos, Predict_Vector $sol, &$depth) { $Rho = new Predict_Vector(); $earth = new Predict_Vector(); /* Determine partial eclipse */ $sd_earth = Predict_Math::ArcSin(Predict::xkmper / $pos->w); Predict_Math::Vec_Sub($sol, $pos, $Rho); $sd_sun = Predict_Math::ArcSin(Predict::__sr__ / $Rho->w); Predict_Math::Scalar_Multiply(-1, $pos, $earth); $delta = Predict_Math::Angle($sol, $earth); $depth = $sd_earth - $sd_sun - $delta; if ($sd_earth < $sd_sun) { return 0; } else { if ($depth >= 0) { return 1; } else { return 0; } } }
public static function Calculate_Obs($_time, Predict_Vector $pos, Predict_Vector $vel, Predict_Geodetic $geodetic, Predict_ObsSet $obs_set) { $obs_pos = new Predict_Vector(); $obs_vel = new Predict_Vector(); $range = new Predict_Vector(); $rgvel = new Predict_Vector(); self::Calculate_User_PosVel($_time, $geodetic, $obs_pos, $obs_vel); $range->x = $pos->x - $obs_pos->x; $range->y = $pos->y - $obs_pos->y; $range->z = $pos->z - $obs_pos->z; $rgvel->x = $vel->x - $obs_vel->x; $rgvel->y = $vel->y - $obs_vel->y; $rgvel->z = $vel->z - $obs_vel->z; $range->w = sqrt($range->x * $range->x + $range->y * $range->y + $range->z * $range->z); $sin_lat = sin($geodetic->lat); $cos_lat = cos($geodetic->lat); $sin_theta = sin($geodetic->theta); $cos_theta = cos($geodetic->theta); $top_s = $sin_lat * $cos_theta * $range->x + $sin_lat * $sin_theta * $range->y - $cos_lat * $range->z; $top_e = -$sin_theta * $range->x + $cos_theta * $range->y; $top_z = $cos_lat * $cos_theta * $range->x + $cos_lat * $sin_theta * $range->y + $sin_lat * $range->z; $azim = atan(-$top_e / $top_s); /*Azimuth*/ if ($top_s > 0) { $azim = $azim + Predict::pi; } if ($azim < 0) { $azim = $azim + Predict::twopi; } $el = Predict_Math::ArcSin($top_z / $range->w); $obs_set->az = $azim; /* Azimuth (radians) */ $obs_set->el = $el; /* Elevation (radians)*/ $obs_set->range = $range->w; /* Range (kilometers) */ /* Range Rate (kilometers/second)*/ $obs_set->range_rate = Predict_Math::Dot($range, $rgvel) / $range->w; /* Corrections for atmospheric refraction */ /* Reference: Astronomical Algorithms by Jean Meeus, pp. 101-104 */ /* Correction is meaningless when apparent elevation is below horizon */ // obs_set->el = obs_set->el + Radians((1.02/tan(Radians(Degrees(el)+ // 10.3/(Degrees(el)+5.11))))/60); if ($obs_set->el < 0) { $obs_set->el = $el; /*Reset to true elevation*/ } }