|
|
|
/* Author: Farrukh Shahzad */
// This function was originally written by R.V. as
// shown on the algorithm section of code gallery (http://www.zend.com/codex.php?
id=32&single=1).
// I tried that function and found that it is not given the same answer (I dont know whether
Raplh's math is right)
// as given by my function shown below.
//Also It is much simpler math and gives direction of 2nd point with respect first
function calcMiles($lat1, $lon1, $lat2, $lon2) {
$deg2mile = 69.09; //for earth
$temp1 = cos(deg2rad($lat1));
$temp2 = cos(deg2rad($lat2));
$dist = sqrt( $temp1 * $temp2 * pow($lon1 - $lon2 , 2) + pow($lat1 - $lat2, 2) );
$miles = $dist * $deg2mile;
if ($lat2 == $lat1){
if ($lon2 == $lon1)
$dirstr="";
else {
if($lon2 > $lon1)
$dirstr = "East";
else
$dirstr = "West";
}
}else if($lat2 < $lat1){
if($lon2 == $lon1)
$dirstr="North";
else {
if($lon2 > $lon1)
$dirstr="NorthEast";
else
$dirstr="NorthWest";
}
}else if ($lat2 > $lat1){
if($lon2 == $lon1)
$dirstr="South";
else {
if($lon2 > $lon1)
$dirstr="SouthEast";
else $dirstr="SouthWest";
}
}
$miles = sprintf("%0.2f miles %s",$miles,$dirstr);
return $miles;
} |
|
| 3dLib - a class for drawing in 3D space. Supported functions: Line, SetPixel, Polygon, FilledPolygon, etc. 3dChart() function has been added for one-call drawing of 3d charts. Support of mostly used 3d-transformations. Categories : Graphics, Math., PHP Classes, PHP, Charts and Graphs | | | Library of math functions to expand the functionality of PHP3. Version 1.2.1 fixes a major problem with the gcd function.
Categories : Algorithms, PHP, Math. | | | mediaCat-GTK v2.0.0 - an mp3/cd/dvd cataloging utility written in php-gtk which interfaces with mysql and ms access (or db supported by PHP's Unified ODBC Functions) Categories : PHP, MySQL, MS Access, Utilities, Databases | | | Math operations on big numbers Categories : PHP, Math. | | | Quote For the Day Categories : PHP, Utilities, Filesystem | | | Prime number finder (Sieve of Erastothenes) Categories : PHP, Algorithms, Math. | | | grab directory listings into an array the example prints out each
subdirectory in the main dir - further work is to be performed on this one Categories : Filesystem, PHP, Directories, Search, Utilities | | | Kasskooye($path) tell you the complete size of a folder
Categories : PHP, Algorithms, Utilities, Filesystem | | | Diffusion-Limited Aggregation visualization Categories : PHP, Graphics, Algorithms, Math. | | | PHP-CSL PHP Code Snippet Library, A very handy application designed to save you many hours by storing all your code snippets, classes and functions. Categories : PHP, Utilities, MySQL, Databases, To PHP | | | Reverse a given number Categories : PHP, Beginner Guides, Algorithms, Math. | | | Monitor the files you provide for download! Track who downloads your
files, and when. Categories : PHP, Complete Programs, Utilities | | | Easy to use random number function that seeds with uniqid and allows a max value Categories : Math., PHP | | | decoct -- Decimal to octal Categories : PHP, PHP Functions, Math. | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | |
|
|