Esempio n. 1
0
 /**
  * @param CM_Geo_Point $pointTo
  * @return float
  */
 public function calculateDistanceTo(CM_Geo_Point $pointTo)
 {
     $pi180 = M_PI / 180;
     $currentRadianLatitude = $this->getLatitude() * $pi180;
     $currentRadianLongitude = $this->getLongitude() * $pi180;
     $againstRadianLatitude = $pointTo->getLatitude() * $pi180;
     $againstRadianLongitude = $pointTo->getLongitude() * $pi180;
     $arcCosine = acos(sin($currentRadianLatitude) * sin($againstRadianLatitude) + cos($currentRadianLatitude) * cos($againstRadianLatitude) * cos($currentRadianLongitude - $againstRadianLongitude));
     return CM_Model_Location::EARTH_RADIUS * $arcCosine;
 }
Esempio n. 2
0
 public function testGetSetLongitudeZero()
 {
     $point = new CM_Geo_Point(11.2, 13.2);
     $point->setLongitude(0);
     $this->assertSame(0.0, $point->getLongitude());
 }