public function testMultiDate() { $target = SSObj::Mercury(); $center = SSObj::Earth(); $jd1 = 2451545; $jdN = 2451546; $step = 0.1; $format = '%+0.15E'; //echo "\n\n$center -> $target\n"; $de = new Reader(); for ($jd = $jd1; $jd < $jdN; $jd += $step) { $pv = $de->jde($jd)->position($target, $center); /* echo "\n$jd\n[ " . sprintf($format, $pv[0]); echo " " . sprintf($format, $pv[1]); echo " " . sprintf($format, $pv[2]) . " ]"; echo "\n[ " . sprintf($format, $pv[3]); echo " " . sprintf($format, $pv[4]); echo " " . sprintf($format, $pv[5]) . " ]\n"; * */ } }
/** * Interpolates the solar system barycentric position of an object * * @param SSObj $obj Object to interpolate * * @return array Position/Velocity vector */ protected function interpObject(SSObj $obj) { // Solar System barycenter is always a zero vector if ($obj == SSObj::SolarBary()) { return [0, 0, 0, 0, 0, 0]; } // Calculate Earth position if ($obj == SSObj::Earth()) { // Earth-Moon mass ratio $emrat = $this->header->const->EMRAT; // Get Earth-Moon barycenter and geocentric moon positions $emb = $this->interp(SSObj::EarthBary()->id, 6); $moon = $this->interp(SSObj::Moon()->id, 6); // PV of Earth with respect to Solar System barycenter return [$emb[0] - 1 / (1 + $emrat) * $moon[0], $emb[1] - 1 / (1 + $emrat) * $moon[1], $emb[2] - 1 / (1 + $emrat) * $moon[2], $emb[3] - 1 / (1 + $emrat) * $moon[3], $emb[4] - 1 / (1 + $emrat) * $moon[4], $emb[5] - 1 / (1 + $emrat) * $moon[5]]; } // Calculate Moon position if ($obj == SSObj::Moon()) { $moon = $this->interp(SSObj::Moon()->id, 6); $earth = $this->interpObject(SSObj::Earth()); return [$moon[0] + $earth[0], $moon[1] + $earth[1], $moon[2] + $earth[2], $moon[3] + $earth[3], $moon[4] + $earth[4], $moon[5] + $earth[5]]; } // Interpolate position return $this->interp($obj->id, 6); }