Exemplo n.º 1
0
 /**
  * Creates a new Cartesian vector instance
  *
  * @param Frame           $frame Reference frame
  * @param Epoch|AstroDate $epoch Observation epoch
  * @param Distance        $x     x position
  * @param Distance        $y     y position
  * @param Distance        $z     z position
  * @param Velocity        $vx    x velocity
  * @param Velocity        $vy    y velocity
  * @param Velocity        $vz    z velocity
  */
 public function __construct(Frame $frame, $epoch, Distance $x, Distance $y, Distance $z, Velocity $vx = null, Velocity $vy = null, Velocity $vz = null)
 {
     // Set reference frame and observation epoch
     $this->frame = $frame;
     $this->epoch = $epoch instanceof Epoch ? $epoch : $epoch->toEpoch();
     // Set position components
     $this->x = $x;
     $this->y = $y;
     $this->z = $z;
     // Set velocity components
     $this->vx = $vx;
     $this->vy = $vy;
     $this->vz = $vz;
     // Set default rounding and units
     $this->decimalPlaces = 13;
 }
Exemplo n.º 2
0
 /**
  * @covers Marando\AstroDate\AstroDate::toEpoch
  */
 public function testToEpoch()
 {
     $dt = new AstroDate(2000, 1, 1, 12, 0, 0, null, TimeScale::TT());
     $this->assertEquals((string) Epoch::J2000(), (string) $dt->toEpoch());
 }