Example #1
0
 public function testToParallax()
 {
     $stars = ['Proxima Centauri' => [Angle::mas(768.13), 1.30186, 0.01], 'Luhman 16' => [Angle::mas(500.51), 1.998, 0.01], 'Sirius' => [Angle::mas(379.21), 2.637, 0.01], 'WISE 0855-0710' => [Angle::mas(449), 2.23, 1]];
     foreach ($stars as $star => $data) {
         $parallax = $data[0];
         $parsecs = $data[1];
         $accuracy = $data[2];
         $dist = Distance::pc($parsecs);
         $this->assertEquals($parallax->mas, $dist->parallax->mas, $star, $accuracy);
     }
 }
Example #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));
 }
Example #3
0
class Angle implements animal,monkey,wisdom,bird{
	public function eat(){
		echo '吃';
	}	

	public function run(){
		echo '走';
	}

	public function cry(){
		echo '哭';
	}

	public function think(){
		echo '思考';
	}

	public function fly(){
		echo '张开翅膀保护你!<br />';
	}
}


$angle1 = new Angle();
$angle1->fly();




?>
Example #4
0
 /**
  * Returns a new angle with the negation of this instance.
  *
  * @return static
  */
 public function neg()
 {
     return Angle::mas($this->mas * -1);
 }
Example #5
0
 public function testToDMS()
 {
     $angleObject = new Angle(2, Angle::RADIANS);
     $angleValue = $angleObject->toDMS(2);
     $this->assertEquals("114°35'29.61\"", $angleValue);
 }
/*
根据接口,造一个天使
*/

class Angle implements bird{

	public function eat(){
		echo '吃空气';
	}
	public function fly(){
		echo '张开翅膀保护你!<br />';
	}
}


$angle1 = new Angle();
$angle1->eat(); //吃
$angle1->fly(); //飞


interface People extends monkey{
	public function UsePhone(); //使用手机

}


//新的人类出现了

class Extraterrestrial implements People{
	public function UsePhone(){
		echo '玩微信!<br />';
Example #7
0
 /**
  * Returns a new <code>Angle</code> instance.
  *
  * @param  float  $radians
  * @return Angle
  */
 public static function create($radians)
 {
     $angle = new Angle();
     $angle->set($radians);
     return $angle;
 }
Example #8
0
 /**
  * Converts this instance to an angle representing the number of
  * revolutions of a duration of time within a specified time interval.
  *
  * @param Time $interval
  *
  * @return Angle
  */
 public function toAngle(Time $interval = null)
 {
     return Angle::time($this, $interval);
 }