示例#1
0
 static function getMoonIllumination($date)
 {
     $d = suncalc_SunCalc::toDays($date);
     $s = suncalc_SunCalc::sunCoords($d);
     $m = suncalc_SunCalc::moonCoords($d);
     $astronomical_unit = 149598000;
     $phi = Math::acos(Math::sin($s->dec) * Math::sin($m->dec) + Math::cos($s->dec) * Math::cos($m->dec) * Math::cos($s->ra - $m->ra));
     $inc = Math::atan2($astronomical_unit * Math::sin($phi), $m->dist - $astronomical_unit * Math::cos($phi));
     $angle = Math::atan2(Math::cos($s->dec) * Math::sin($s->ra - $m->ra), Math::sin($s->dec) * Math::cos($m->dec) - Math::cos($s->dec) * Math::sin($m->dec) * Math::cos($s->ra - $m->ra));
     return _hx_anonymous(array("fraction" => (1 + Math::cos($inc)) / 2, "phase" => 0.5 + 0.5 * $inc * ($angle < 0 ? -1 : 1) / Math::$PI, "angle" => $angle));
 }