Revision 7f9aab46
Added by Victor Pongnian almost 11 years ago
class/site_point.class.php  

9  9 
public function __construct($dir) { 
10  10 
$this>base_dir = $dir; 
11  11 
$dir_fd = opendir($this>base_dir); 
12 


12  13 
while (false !== ($file = readdir($dir_fd))) { 
14 


13  15 
if (preg_match('/(.*)_[09]+_[09]+_[09]+\.jpg$/', $file, $reg)) { 
14  16 
$this>prefix = $reg[1]; 
17 


15  18 
break; 
16  19 
} 
17  20 
} 
...  ...  
20  23 
$pfname = $this>base_dir.'/'.$this>prefix.'.params'; 
21  24 
if (is_file($pfname)) { 
22  25 
$this>params = @parse_ini_file($pfname); 
23 
} 

26 
}


24  27 
} 
25  28 

26  29 
public function get_params() { 
...  ...  
65  68 
$lon2 = $lon * M_PI/180; 
66  69  
67  70 
$dLat = $lat2$lat1; 
68 
$dLon = $lon2$lon1; 

71 
$dLon = $lon2$lon1;


69  72 

70 
$a = sin($dLat/2) * sin($dLat/2) + sin($dLon/2) * sin($dLon/2) * cos($lat1) * cos($lat2); 

73 
$a = sin($dLat/2) * sin($dLat/2) + sin($dLon/2) * sin($dLon/2) * cos($lat1) * cos($lat2); //


71  74 
$angle = 2 * atan2(sqrt($a), sqrt(1$a)); 
72  75 
$d = $angle * $rt; // distance du point en Kms 
73  76 

74  77 
$y = sin($dLon)*cos($lat2); 
75  78 
$x = cos($lat1)*sin($lat2)  sin($lat1)*cos($lat2)*cos($dLon); 
76  79 
$cap = atan2($y, $x); // cap pour atteindre le point en radians 
77  
80 


78  81 
$e = atan2(($alt2  $alt1)/1000  $d*$d/(2*$rt), $d); // angle de l'élévation en radians 
79  82 
// printf("%s, %s, %s, %s\n",$lat1, $this>params['latitude'], $lat, $dLat); 
80  
81 
return array($d, $cap*180/M_PI, $e*180/M_PI); // les résultats sont en degrés 

83 


84 
return array($d, $cap*180/M_PI, $e*180/M_PI, $rapport); // les résultats sont en degrés


82  85 
} 
83  86 

84  87 
} 
Also available in: Unified diff
Version réaliée pour la sage de Victor Pongnian