Exemple #1
0
 public function testToEclip()
 {
     // Earth -> Venus @ 2015-Nov-08 23:20:34.000 UT
     $dt = AstroDate::jd(2457335.47261574);
     $x = Distance::au(-0.7956853147170494);
     $y = Distance::au(-0.00807301690301796);
     $z = Distance::au(0.01392567642390632);
     $c = new Cartesian(Frame::ICRF(), $dt->toEpoch(), $x, $y, $z);
     $equat = $c->toEquat();
     $eclip = $equat->toEclip();
     $prec = Angle::arcmin(13)->deg;
     $this->assertEquals(180.3510658, $eclip->lon->deg, 'λ', $prec);
     $this->assertEquals(1.1487465, $eclip->lat->deg, 'β', $prec);
 }
Exemple #2
0
 /**
  * Calculates the radial distance, r of this instance
  *
  * @return float
  */
 private function calcR()
 {
     $x = $this->x->au;
     $y = $this->y->au;
     $z = $this->z->au;
     return Distance::au(sqrt($x * $x + $y * $y + $z * $z));
 }
Exemple #3
0
 public function test()
 {
     return;
     $frame = Frame::ICRF();
     $epoch = Epoch::J(2000);
     echo $epoch->toDate()->toTDB();
     echo "\n";
     echo "\n";
     exit;
     $ra = \Marando\Units\Time::hms(11, 16, 46.6);
     $dec = \Marando\Units\Angle::dms(5, 45, 32.5);
     $dist = Distance::au(5.8);
     echo "\n" . ($eq = new Equat($frame, $epoch, $ra, $dec, $dist));
     echo "\n" . ($eq = (new Equat($frame, $epoch, $ra, $dec, $dist))->apparent());
     echo "\n";
     return;
     $frame = Frame::ICRF();
     $epoch = AstroDate::jd(2457335.472615741)->toEpoch();
     $ra = \Marando\Units\Time::hms(11, 16, 46.6);
     $dec = \Marando\Units\Angle::dms(5, 45, 32.5);
     $dist = Distance::au(5.8);
     echo "\n" . ($eq = new Equat($frame, $epoch, $ra, $dec, $dist));
     echo "\n" . ($eq = (new Equat($frame, $epoch, $ra, $dec, $dist))->apparent());
     $eq = new Equat($frame, $epoch, $ra, $dec, $dist);
     $eq->topo = Geo::deg(27, -82);
     echo "\n" . $eq->toHoriz();
     echo "\n" . $eq->apparent();
     echo "\n" . ($h = $eq->toHoriz());
     echo "\n" . $h->az->deg . "\t" . $h->alt->deg;
     echo "\n" . $eq->apparent(\Marando\Units\Pressure::mbar(100), \Marando\Units\Temperature::F(90), 0.85);
     echo "\n" . $eq->toHoriz();
     return;
     $ra = \Marando\Units\Time::hours(14.424354);
     $dec = \Marando\Units\Angle::deg(33.54366);
     $dist = Distance::au(1.5);
     $geo = Geo::deg(27, -82);
     $e = new Equat(Frame::ICRF(), Epoch::jd(2455586), $ra, $dec, $dist);
     $e->topo = $geo;
     echo "\n\n" . $e;
     echo "\n" . $e->apparent();
     $e = new Equat(Frame::ICRF(), Epoch::jd(2455586), $ra, $dec, $dist);
     $e->topo = $geo;
     echo "\n" . $e->apparent();
     $e = new Equat(Frame::ICRF(), Epoch::jd(2455586), $ra, $dec, $dist);
     $e->topo = $geo;
     echo "\n" . $e->toHoriz();
     return;
     $e = new Equat(Frame::ICRF(), Epoch::jd(2455586), $ra, $dec, $dist);
     echo "\n\n" . $e;
     echo "\n" . $e->apparent($geo);
     echo "\n" . $e->apparent()->toHoriz($geo);
     $e = new Equat(Frame::ICRF(), Epoch::jd(2455586), $ra, $dec, $dist);
     echo "\n\n" . $e;
     echo "\n" . $e->apparent();
     echo "\n" . $e->apparent()->toHoriz();
     $e = new Equat(Frame::ICRF(), Epoch::jd(2451586), $ra, $dec, $dist);
     $e->topo = $geo;
     echo "\n\n" . $e;
     echo "\n" . $e->apparent();
     echo "\n" . $e->apparent()->toHoriz();
     return;
     // Position of Mercury
     $x = Distance::au(+1.18052679326447);
     $y = Distance::au(-0.3650485652522116);
     $z = Distance::au(-0.2123422968928603);
     // Velocity of Mercury
     $vx = Velocity::aud(0.02052320553396918);
     $vy = Velocity::aud(0.02828864020900079);
     $vz = Velocity::aud(0.01145246106968459);
     // Frame & epoch
     $frame = Frame::ICRF();
     $epoch = AstroDate::parse('2015-Mar-20')->toEpoch();
     $c = new Cartesian($frame, $epoch, $x, $y, $z, $vx, $vy, $vz);
     echo "\n\n";
     echo $c;
     echo "\n\n";
     echo $c->setUnit('km km/d');
     echo "\n\n";
     echo $c->setUnit('km km/s');
     echo "\n\n";
     echo $c->toEquat();
     echo "\n\n";
     echo $c->toEquat()->apparent();
     echo "\n\n";
     echo $c->toEquat()->apparent(Geo::deg(27, 278));
     echo "\n\n";
     echo $c->toEquat()->toHoriz(Geo::deg(27, 278));
     echo "\n\n";
 }
Exemple #4
0
 /**
  * Calculates the distance traveled in the provided time at the velocity of
  * this instance.
  *
  * @param Time $time
  *
  * @return Distance
  */
 public function dist(Time $time)
 {
     return Distance::m($this->dist->m * $time->sec / $this->time->sec);
 }
 public function testCreateWithAstroDate()
 {
     $x = Distance::au(+9.32);
     $y = Distance::au(-5.25);
     $z = Distance::au(-6.89);
     $c = new Cartesian(Frame::ICRF(), AstroDate::now(), $x, $y, $z);
 }
Exemple #6
0
 public function testTime()
 {
     $v = Velocity::mph(70);
     $this->assertEquals(8.5714285714, $v->time(Distance::mi(600))->hours);
 }
Exemple #7
0
 /**
  * Returns a new distance with the negation of this instance.
  *
  * @return static
  */
 public function neg()
 {
     return Distance::m(bcmul($this->m, -1), static::$s);
 }