line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#
|
2
|
|
|
|
|
|
|
# Coordinates system related functions
|
3
|
|
|
|
|
|
|
#
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package OpenGL::Earth::Coords;
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# (1/360.0) * 2 * 3.14159265
|
8
|
1
|
|
|
1
|
|
1074
|
use constant DEG_TO_RAD => 0.0174532925;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
171
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Convert earth latitude/longitude to 3D coords
|
11
|
|
|
|
|
|
|
sub earth_to_xyz ($$$) {
|
12
|
3
|
|
|
3
|
0
|
1986
|
my ($lat, $lon, $radius) = @_;
|
13
|
|
|
|
|
|
|
|
14
|
3
|
|
|
|
|
5
|
$lat *= DEG_TO_RAD;
|
15
|
3
|
|
|
|
|
15
|
$lon *= DEG_TO_RAD;
|
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
|
|
28
|
my $cos_lat = $radius * cos($lat);
|
18
|
|
|
|
|
|
|
|
19
|
3
|
|
|
|
|
5
|
my $x = $cos_lat * cos($lon);
|
20
|
3
|
|
|
|
|
5
|
my $y = $cos_lat * sin($lon);
|
21
|
3
|
|
|
|
|
12
|
my $z = $radius * sin($lat);
|
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
|
|
10
|
return ($x, $y, $z);
|
24
|
|
|
|
|
|
|
}
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1;
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__
|