Beispiel #1
0
 /**
  * Execute a Helmert Transform on this ECEF using the specified Bursa-Wolf Parameters
  *
  * @param     BursaWolfParameters    $bursaWolfParameters    The Bursa-Wolf parameter to use for the transform
  * @return    void
  * @throws    Exception
  */
 private function helmertTransform(BursaWolfParameters $bursaWolfParameters)
 {
     $ppmScaling = 1 + $bursaWolfParameters->getScaleFactor() / 1000000;
     $xCoordinate = $bursaWolfParameters->getTranslationVectors()->getX()->getValue() + $this->xCoordinate->getValue() * $ppmScaling + -$bursaWolfParameters->getRotationMatrix()->getX()->getValue(Angle::RADIANS) * $this->yCoordinate->getValue() + $bursaWolfParameters->getRotationMatrix()->getY()->getValue(Angle::RADIANS) * $this->zCoordinate->getValue();
     $yCoordinate = $bursaWolfParameters->getTranslationVectors()->getY()->getValue() + $bursaWolfParameters->getRotationMatrix()->getZ()->getValue(Angle::RADIANS) * $this->xCoordinate->getValue() + $this->yCoordinate->getValue() * $ppmScaling + -$bursaWolfParameters->getRotationMatrix()->getX()->getValue(Angle::RADIANS) * $this->zCoordinate->getValue();
     $zCoordinate = $bursaWolfParameters->getTranslationVectors()->getZ()->getValue() + -$bursaWolfParameters->getRotationMatrix()->getY()->getValue(Angle::RADIANS) * $this->xCoordinate->getValue() + $bursaWolfParameters->getRotationMatrix()->getX()->getValue(Angle::RADIANS) * $this->yCoordinate->getValue() + $this->zCoordinate->getValue() * $ppmScaling;
     $this->xCoordinate->setValue($xCoordinate);
     $this->yCoordinate->setValue($yCoordinate);
     $this->zCoordinate->setValue($zCoordinate);
 }
Beispiel #2
0
 /**
  * Get the destination for a given initial bearing and distance along a great circle route
  *
  * @param     Angle                 $bearing      Initial bearing
  * @param     Distance              $distance     Distance to travel along the route
  * @param     ReferenceEllipsoid    $ellipsoid    If left blank, a default value of 6371009.0 metres will
  *                                                             be used for the Earth Mean Radius for the calculation;
  *                                                         If a reference ellipsoid is specified, the Authalic Radius for
  *                                                             that ellipsoid will be used.
  * @return    LatLong               The endpoint Lat/Long for a journey from this Lat/Long starting on a bearing
  *                                               of $bearing and travelling for $distance along a great circle route
  * @throws    Exception
  */
 public function getDestination(Angle $bearing, Distance $distance, ReferenceEllipsoid $ellipsoid = null)
 {
     if (!is_null($ellipsoid)) {
         $earthMeanRadius = $ellipsoid->getAuthalicRadius();
     } else {
         $earthMeanRadius = 6371009.0;
         // metres
     }
     $destinationLatitude = asin(sin($this->latitude->getValue(Angle::RADIANS)) * cos($distance->getValue() / $earthMeanRadius) + cos($this->latitude->getValue(Angle::RADIANS)) * sin($distance->getValue() / $earthMeanRadius) * cos($bearing->getValue(Angle::RADIANS)));
     $destinationLongitude = $this->longitude->getValue(Angle::RADIANS) + atan2(sin($bearing->getValue(Angle::RADIANS)) * sin($distance->getValue() / $earthMeanRadius) * cos($this->latitude->getValue(Angle::RADIANS)), cos($distance->getValue() / $earthMeanRadius) - sin($this->latitude->getValue(Angle::RADIANS)) * sin($destinationLatitude));
     return new LatLong(new LatLong\CoordinateValues(self::cleanLatitude($destinationLatitude), self::cleanLongitude($destinationLongitude), Angle::RADIANS));
 }