this module uses 1 subunits
Position
Controller: will
Interface
#include <codecogs/geometry/spherical/angulardistance.h >
double angularDistance (const Position &start, const Position &end)Returns the "distance" in radians (about the spheres centre) between two positions.
double distance (const Position &start, const Position &end, double radToDist=3437.7475)Returns the distance from the start position to the 'end' position.
Function Documentation Calculates the angular between two points on the surface of a sphere relative to the centre of the sphere.
This calculation is made using:
where
a and
b are the start and end location.
Example: #include <stdio.h>
#include <codecogs/geometry/spherical/angularDistance.h >
int main( )
{
Position start( 10 ,-90 ) ;
Position end( 45 ,20 ) ;
printf ( "Angular Distance in Radians = %lf" , angularDistance( start, end) ) ;
return 0 ;
}
Output:
Angular Distance in Radians = 1.686437 Parameters: start the first Position [Latitude, Longitude].[const] [reference] end the second Position [latitude, Longitude].[const] [reference]
Returns: the distance in radian about the center of the sphere. Source Code:
Applies a simple conversion to the distance calculated by
angularDistance to give a more conventional measure
of distance according to the specified conversion ratio. This is simple the circumference of the sphere divided by
.
For example, with the planet earth on degree is divided into 60, which is called 1 minute of arc. This is also one nautical mile.
Therefore to convert radian to nautical miles (knots) you multiply by:
Description radToDist
Nautical Mile on Earth 3437.7475 knots/radian
Miles on Earth 3956.0881 miles/radian
kilometers on Earth 6366.7070 km/radian
Example: #include <stdio.h>
#include <codecogs/geometry/spherical/angulardistance.h >
int main( )
{
Position start( 10 ,-90 ) ;
Position end( 45 ,20 ) ;
printf ( "\n Knots = %lf" , distance( start, end) ) ;
printf ( "\n Miles = %lf" , distance( start, end, 3956.0881 ) ) ;
return 0 ;
}
Output:
Knots = 5797.543498
Miles = 6671.692101 Parameters: start the first Position [Latitude, Longitude].[const] [reference] end the second Position [latitude, Longitude].[const] [reference] radToDist Default Value = 3437.7475
Returns: the distance to new position. Source Code:
Last Modified: 18 Oct 07 @ 17:07 Page Rendered: 2008-05-14 12:20:51
Page Comments
You must login to leave a messge