Skip to content

Commit

Permalink
Added interface for conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
jtejido committed Apr 21, 2018
1 parent a94a0ea commit ff96117
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Geodesy/Distance/VincentyFormula.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,18 @@ public function distance()
}

$uSq = $cosSqAlpha * (pow($a, 2)- pow($b, 2)) / ($b * $b);
$k1 = (sqrt(1 + $uSq) - 1) / (sqrt(1 + $uSq) + 1);
$A = 1 + $uSq / 16384
* (4096 + $uSq * (-768 + $uSq * (320 - 175 * $uSq)));
$B = $uSq / 1024 * (256 + $uSq * (-128 + $uSq * (74 - 47 * $uSq)));

/**
* Alternatively, you can use Helbert's expansion for A and B
*
* $k1 = (sqrt(1 + $uSq) - 1) / (sqrt(1 + $uSq) + 1);
* $A = 1 + ((1/4) * pow($k1, 2)) / (1 - $k1);
* $B = $k1 * (1 - ((3/8) * pow($k1, 2)));
*/

$deltaSigma =
$B * $sinSigma
* ($cos2SigmaM + $B / 4
Expand Down

0 comments on commit ff96117

Please sign in to comment.