geometryspherical

angular Distance

Only available under a commercial licence
COST (GBP)
this unit 1.60
sub units 2.58
add a commercial licence to your cart
0
viewed 3331 times and licensed 19 times
www.codecogs.com/d-ox/geometry/spherical/angulardistance.php
Other modules that are used by this module. We add these to the cart for you whenever you add this module, unless you already own enough licences for them. Click for details
Controller: will    Contact Controller

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

 
doubleangularDistanceconst Position& start
const Position& end )
Calculates the angular between two points on the surface of a sphere relative to the centre of the sphere.

This calculation is made using:
(1)
\displaystyle dist = cos^{-1} \left [ sin(a_{lat}) sin(b_{lat}) + cos(a_{lat}) cos(b_{lat}) cos(b_{long} - a_{long}) \right ]
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:
startthe first Position [Latitude, Longitude].[const][reference]
endthe second Position [latitude, Longitude].[const][reference]
Returns:
the distance in radian about the center of the sphere.
Source Code:
Register

- To get code register with CodeCogs. Already a Member, then Login.


 
doubledistanceconst Position& start
const Position& end
doubleradToDist = 3437.7475 )
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 2 pi . 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:
(2)
\displaystyle \frac{360.0 \cdot 60}{2 \pi}
DescriptionradToDist
Nautical Mile on Earth3437.7475 knots/radian
Miles on Earth3956.0881 miles/radian
kilometers on Earth6366.7070 km/radian
Example:
#include <stdio.h>
#include <codecogs/geometry/spherical/angulardistance.h>
 
int main()
{
  Position start(10,-90);
  Position end(45,20);
  printf("\nKnots = %lf", distance(start, end)); 
  printf("\nMiles = %lf", distance(start, end, 3956.0881)); 
	return 0;
}
Output:
Knots = 5797.543498
Miles = 6671.692101
Parameters:
startthe first Position [Latitude, Longitude].[const][reference]
endthe second Position [latitude, Longitude].[const][reference]
radToDistDefault Value = 3437.7475
Returns:
the distance to new position.
Source Code:
Register

- To get code register with CodeCogs. Already a Member, then Login.


Last Modified: 18 Oct 07 @ 17:07     Page Rendered: 2008-05-14 12:20:51

Page Comments

  You must login to leave a messge


Valid CSS!   Valid XHTML 1.0 Transitional