Raphael Mankin

# NAME

Haversine.pm - Calculations using haversine formula

# SYNOPSIS

``````  use Haversine;
my \$degrees   = recalculate_coordinate([51, 12, 0], 'deg');
my \$radians   = recalculate_coordinate([51, 12, 0], 'rad');
my \$km  = points2distance(\$start, \$end);
my \$degrees  = azimuth(\$start, \$end, 'deg');``````

### recalculate_coordinate(\$location, \$as)

Convert a tupe of (degrees, minutes, seconds) to a normal form.

\$location

An arrayref of three components: degrees, minutes, seconds.

\$as

Return value type. Can be specified as 'deg', 'min', 'sec' or 'rad'; default return value is a proper coordinate tuple.

### points2distance(\$start, \$end)

Calculate distance (in kilometers) between two points given as (lat, long) pairs based on Haversine formula (http://en.wikipedia.org/wiki/Haversine_formula). Implementation inspired by JavaScript implementation from http://www.movable-type.co.uk/scripts/latlong.html

Accepts coordinates as tuples (deg, min, sec), but coordinates can be given in any form - e.g. can specify only minutes: (0, 3133.9333, 0) is interpreted as (52.0, 13.0, 55.998000000008687) which, not accidentally, is the latitude of Warsaw, Poland.

### azimuth(\$start, \$end)

Calculate azimuth (bearing) of one point from another given as (lat, long) pairs based on Haversine formula

### elevation(\$ground, \$star)

Calculate the elevation of a star as seen from a point on the ground. 'star' is the declination and hour angle (lat, long) of the star, 'ground' is the (lat,long) of the ground point.

The elevation is just the complement of the angular distance between the two ground points. We assume that the star is at infinity. Not quite true for the sun or moon.

# AUTHOR

Raphael Mankin, `<rapmankin at cpan.org>`

# BUGS

Please report any bugs or feature requests to `bug-datetime-event-jewish at rt.cpan.org`, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DateTime-Event-Jewish. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

# SUPPORT

You can find documentation for this module with the perldoc command.

``    perldoc DateTime::Event::Jewish``

You can also look for information at:

# LICENSE AND COPYRIGHT

Copyright 2010 Raphael Mankin.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.